Transition between different points of views (SCNCameras) in SceneView - ios8

I've built a basic scene for SceneKit, including several SCNNodes with geometries, SCNLights, and an SCNCamera. I would now like to add functionality whereby the point of view shifts between different camera positions when the user taps on the screen.
What is the best way to achieve this? Should I include several SCNCameras in the scene and switch sceneView.pointOfView between them? Or should I rather update the position (and orientation) of a single camera. Also, how can I specify the transition path from moving from the old to the new camera position, i.e. use animation for the transition.

changing the pointOfView of the view is the easiest way. But if you want to control the path you will have to move the camera yourself. You can do that with SCNAction or by using CoreAnimation explicit or implicit animations.

Related

Aframe a-sky change rotation upon scene change

Hi I am trying to navigate between scenes. And when i navigate between scenes, i am not able to set/update rotation of the changed scene. i am storing rotation of scenes and then navigate between. Please help struggling from many days
Link to my code on Glitch https://glitch.com/~thin-newsstand
Working explained.
1. Save camera button saves the rotation into select along with the scene and
custom data attribute name data-r
2. If you inspect select dropdown options, you will notice.
3. When select option is changed, it will change sky image from select option and also change rotation.
4. I have used aframe-viewable-component.js to restrict top/bottom movement of skybox.
It sounds like you want to save and restore camera rotation, when a new panorama is loaded.
Since you are using the look-controls component on the camera, you will need to do this using that component. It might be best to modify that component, and create your own custom variation. You can download the original here:
https://github.com/aframevr/aframe/blob/master/src/components/look-controls.js
The component does have a built in function for saving and restoring position and rotation
saveCameraPose: function ()
restoreCameraPose: function ()
as it is written, the component can only save one entry
this.savedPose.position.copy(el.object3D.position);
this.savedPose.rotation.copy(el.object3D.rotation);
Depending on what you want, you may have to save the position/rotation to new variable that are associated with each pano, so that when a new pano is selected, that same entry for camera pos/rot is also loaded and camera restored. It would probably be best to do this with an array. Psuedo code looks something like:
Make an array (containing objects: {camPos, camRot}). named savedCamPR.
When new pano is selected get the index of current pano. named curPanoID
Save the look-controls pos/rot to savedCamPR[curPanoID], ie the array using the index of current pano.
Get the index of the new pao.
if there is a saved entry in the in savedCamPR, use that to restore the camera.
If you have trouble figuring it out, let us know, and I can probably make an online example that saves and restored camera positions for multiple panos.

Group of objects on top but added to a camera

As a precision I already noticed threads about this but didn't find a way to achieve exactly what I need.
Basicaly I have a board of objects that I need remaining always on top of everything but also attached to the camera.
I first tried to add the group to the camera and it stayed as wished always in the viewport. But in this configuration the group of objects still be a part of the scene so while zooming to regular objects in the "editor" the board goes into/among these objects of the scene.
My second trial was based on this thread and work wonderfully in order to get all of the board objects rendered above everything. But on such a configuration when rotating around the axis (with orbit control) both scenes rotates. So I tried to update the foreground scene with coordinates of the camera but the update was not immediate and this scene is flickering (I suppose that while rotating the update function is not called immediately).
My best wish would have been to "attach" the foreground scene to the camera so that it would stay on top and sticked on the screen/viewport but I don't even know if it is possible and how to do that (as only groups of objects seem to be capable to be attached to the camera).
I am really stuck on that point. Thanks you for any help!
If this is what you need,
just set object.material.depthTest = false; and object.renderOrder = 1000; for all objects you need to be always on top and attached to the camera.

How do I put an interactable Canvas onto a 3D game object?

Is it possible to place a UI Canvas onto a 3D object? I'd like to create a cash dispenser machine (for example) with a user interface that can be interacted with. Then there will be keycode locks on doors, touchscreen computers, etc.
How can I display a canvas as a 3D object in the 3D world and still have it interactable? Placing it on a Plane would be good enough.
Yes, it is possible. Change Canvas Render Mode to World Space then drag your Camera into the Event Camera slot. You will have to find select the Canvas, press F in Scene View to find it then move it to the place you want it to be.
You need to use World Space UI. Can place anywhere in scene but make sure use can view it in order to interact.
To learn more, watch this video : https://blogs.unity3d.com/2014/06/30/unity-4-6-new-ui-world-space-canvas/

Unity3d Updating position with animation simultaneously

I have an animation for humanoid models to simulate climbing. I have been looking for a way to stimulate this animation when the model comes next to the window. I used the triggers to determine where the model is and it worked. However, when I execute the animation, the position of the model is not being updated according to the animation. I am using offmesh links and nav mesh agent and I disable nav mesh agent when the model triggers. How can I use the animation and provide the update simultaneously?
Animation Properties
Thanks in advance.
I don't think the animation should take care of the movement. You should control that somewhere else. You could make the animation climb from y = 0 to 5 but then it won't work if your ladder is at y = 3.
You'd better have a method that is called from the animation using AnimationEvent so that when you trigger the animation, it also triggers a movement of the object upwards/downwards regardless of the current position of the object. It would simply use Translate and disabled input until the animation ends.

Threejs Rotating object with device orientation control

I am trying to achieve an effect similar to one of the cardboard app examples that Google has put out with their cardboard app called the 'exhibit'. I have a 3D object that I want to rotate using device orientation control. Right now with just the device orientation control, I can view the 3D object but when I turn around, the camera rotates (it seems) causing the object to fall out of view until I turn all the way back around to where it was in the beginning. In other words the camera seems to rotate in its axis as I look around. What I want is to be able to rotate the object as I turn around.
Kinda like this example http://threejs.org/examples/#misc_controls_orbit except I want to rotate using device orientation control.
Any idea how I can incorporate this feature?
Thank you for your assistance.
The answer to my own question for future seekers is to replace camera in
controls = new THREE.DeviceOrientationControls(camera, true);
with the 3D object you are trying to rotate.

Resources