Jump to content

Set new position of WebVRFreeCamera


Steffen
 Share

Recommended Posts

Hi,

I've got my vive and the controllers working and now I want to implement some teleporting feature to move around. So I have some kind of a laserpointer to choose the new position. How can I link the new position as the start position of the webVRFreeCamera (with options-flag "trackPosition:true")?

Because the vive overrides my positions, I'm adding "newPos" to "scene.activeCamera" every frame. But there seems to be an offset. And obviously, if I set "scene.activeCamera.position = newPos" and not "+=", the trackPosition isn't working any more.

Thanks

Link to comment
Share on other sites

  • 5 weeks later...

A month later, and here I am!

I see the problem, you need some kind of a position offset. It exists for the rotationQuaternion, but not for the position. 

The quickest solution would be to add newPos in a beforeRender loop, which runs after the camera got its new position. so, the camera gets the new position, and you set the offset right after, the scene renders, the camera gets a new position, and the fun continues. But I can add a position offset just like the rotation offset which exists in the VR cameras. If it helps.

Link to comment
Share on other sites

So! I felt like commiting something today.

The WebVR camera has now a setPositionOffset function that takes a vector3 as an optional parameter. This will be the new offset position from which the position provided by WebVR will be calculated. if you don't provide any vector3, the current camera position will be used as the new offset.

We are one step closer to real life teleportation! 

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...