darcome Posted March 13, 2016 Share Posted March 13, 2016 Hello everyone, How do i set the initial lookat or direction or I don't know how to call it of the VRDeviceOrientationFreeCamera? Here are 2 examples: http://www.ildema.com/vrdemo/vr.html and http://www.ildema.com/vrdemo/vr2.html the only thing that changes between the two links is this.camera.setTarget (new BABYLON.Vector3 (-6.7, 1.2, -1.3)); in vr.html and this.camera.setTarget (BABYLON.Vector3.Zero ()); in vr2.html but when I load them in my iphone the camera points always in the same direction Can you tell me what is the right code to use? Thanks in advance Quote Link to comment Share on other sites More sharing options...
Wingnut Posted March 13, 2016 Share Posted March 13, 2016 Hi again, Darcome! I'm not very experienced with these things... but... take a look at this... https://github.com/BabylonJS/Babylon.js/search?utf8=%E2%9C%93&q=metrics Fancy input devices like headsets and orienters... have a "pile of data" that they "communicate"... called a "metrics" object. Goof-around until you can display all the "metrics" that are set... when you plug-in your orienter/phone. You may find an .initialViewVector (or similar) metric/property ... existing on the phone's metrics object. I could be wrong, but it is one idea to try. Keep us posted. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 13, 2016 Share Posted March 13, 2016 Hello! In order to help you, can you try to reproduce your issue in the PG? Quote Link to comment Share on other sites More sharing options...
darcome Posted March 13, 2016 Author Share Posted March 13, 2016 hello deltakosh! Here they are: http://www.babylonjs-playground.com/#2HNDXP and http://www.babylonjs-playground.com/#SISOS They are the same except for the camera and in the second I added a cube to be sure on the phone i was loading a different PG But when i load in to the phone, the position of the camera is the same Thanks in advance for your help Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 13, 2016 Share Posted March 13, 2016 This is not a bug but the standard behavior of the vrDeviceOrientationCamera. On first start, the device orientation event is called to get the correct orientation. If you still want to force a target, you can use this trick: http://www.babylonjs-playground.com/#2HNDXP#1 Quote Link to comment Share on other sites More sharing options...
darcome Posted March 13, 2016 Author Share Posted March 13, 2016 I admit I haven't tried it yet, but what I am looking for is the following: Imagine this use case: A virtual tour of a museum... the camera moves automatically through the corridors and the user can look around moving the phone... At a certain moment the camera stops because it is in front of a painting and an mp3 starts with the description of the painting. But the painting is facing RIGHT while the user is facing LEFT. What I want is to stop the movement of the camera from phone input, and move it to the RIGHT automatically. After that I want to reactivate the phone movements but limit them so the user will always face the painting. After the mp3 has finished, the tour restarts, so the camera will move automatically and the user will be able to look around moving the phone... after a while, another painting is coming and so on.... How can I accomplish it? I think this would be useful for all sorts of virtual tours... Thanks in advance for your help Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 13, 2016 Share Posted March 13, 2016 Hehe this is the perfect use case for the new input system! You can disable vr input when you want to control the POV manually: camera.inputs.removeByType("FreeCameraVRDeviceOrientationInput"); or by reference: camera.inputs.remove(camera.inputs.attached.VRDeviceOrientation) And then restore it: camera.inputs.addVRDeviceOrientation(); http://www.babylonjs-playground.com/#2HNDXP#2 Quote Link to comment Share on other sites More sharing options...
darcome Posted March 13, 2016 Author Share Posted March 13, 2016 Sorry to bother you.... but I have some questions: 1) Is it avalaible in 2.3 or in 2.4 alpha? 2) Where I can find some documentation? 3) If I remove the vr camera, what camera remains active? 4) or I have to add two cameras... a FreeCamera and a VrOrientationDeviceFreeCamera, so when i remove the vr camera, the free camera takes its place? 5) In any case... When I remove the vr camera and move the freecamera.... when I reactivate the vr camera, it takes the current position as its starting position or it moves the camera using global device orientation? What I mean is... let's suppose the user is facing down with the phone.... I remove the vr and move the camera up by 180°, then i reactivate vr... the phone is still facing down... what will happen to the camera? Will it continue to face up, so if I rotate the phone up by 90° the new camera orientation will be 180° + 90° or it will "reset" to facing down + 90° up movement? I hope I've been clear it's not easy to explain in english.... eheheh As usual, thanks in advance for the answers! Thanks in advance for your answers! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 14, 2016 Share Posted March 14, 2016 1. Only 2.4 2. Documentation is under construction (this is a brand new feature) so expect it within a couple of days 3. None (but in my example you did not remove a camera, just an input method..the camera remains active) 4.This is also a solution but less elegant than mine 5.this is why removing only input methods is better Quote Link to comment Share on other sites More sharing options...
darcome Posted March 14, 2016 Author Share Posted March 14, 2016 Good! I hope to see documentation as soon as possie, because I'm eager to try this new input method Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 15, 2016 Share Posted March 15, 2016 Here is the doc: http://doc.babylonjs.com/tutorials/19._Customizing_Camera_Inputs Wingnut and jerome 2 Quote Link to comment Share on other sites More sharing options...
darcome Posted March 15, 2016 Author Share Posted March 15, 2016 Thank you very much Deltakosh! I'll try it ASAP! Quote Link to comment Share on other sites More sharing options...
darcome Posted March 15, 2016 Author Share Posted March 15, 2016 Hello Deltakosh, I tried these PGs http://www.babylonjs-playground.com/#7WKBJ and http://www.babylonjs-playground.com/#DZTQH but when viewed with a phone, I obtain the same result, despite of the different setTarget... What am I doing wrong? Thanks in advance for your help Quote Link to comment Share on other sites More sharing options...
jerome Posted March 15, 2016 Share Posted March 15, 2016 Congrats Every new feature is always a good surprise Every new doc about a new feature is always a damn good surprise Vousk-prod. and Wingnut 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 15, 2016 Share Posted March 15, 2016 I think I misunderstood your ask. As long as you attachControl, the VrDeviceOrientation will align with the device orientation info NO MATTER what you defined as a target before. But you can hijack the system like this: http://www.babylonjs-playground.com/#DZTQH#2 Wingnut and JackFalcon 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.