Jump to content

How to set initial "lookAt" of VRDeviceOrientationFreeCamera?


darcome
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...