Has anybody experimented with trackpad point and teleport locomotion versus the "floating eye boxes" in the Vive demo?
Hey There,
Im also wondering about locomotion system for vred. It`s really great system, integration for vred would be awesome..
Cheers
I am totally new for VRED and Im starting to learn it for VR purposes in our company, so Im trying to figure this out but without success.
It looks like we need to have pre-set viewpoints and teleport between those. I was able to duplicate those that are in demoset, create the camera for it but im still teleportating to the same one position.... Bit furstrating, not a lot of learning materials about this...
Hi,
here is a small script that implements some teleportation in VRED:
controller0 = None class Teleporter: def __init__( self ): self._nodeTelePoint = findNode("TelePoint") self.setLocation( 0, 0 ) self.setLookat( 0,100000 ) def setLocation( self, x, y ): self._loc = Pnt2f( x, y ) def location( self ): return self._loc def setLookat( self, x, y ): self._lookAt = Pnt2f( x, y ) def lookat( self ): return self._lookAt def activate( self ): self._nodeTelePoint.setActive(True) def deactivate( self ): self._nodeTelePoint.setActive(False) def updateTeleportLocation( self, pick ): self._nodeTelePoint.setTranslation(pick.x(),pick.y(),100) def teleport( self, pick, pickNode ): nodeHMD = getCamNode(-1).getWorldTransform() pos = self.location() newOriginX = pick.x()-nodeHMD[3]+pos.x() # calculate new X newOriginY = pick.y()-nodeHMD[7]+pos.y() # calculate new Y newOriginZ = 0 setFromAtUp( -1, newOriginX, newOriginY, newOriginZ, self._lookAt.x() - newOriginX, self._lookAt.y() - newOriginY, newOriginZ, 0, 0, 1 ) self.setLocation( newOriginX, newOriginY ) theTeleporter = Teleporter() def trigger0Pressed(): global theTeleporter controller0.setPickingAxis(1) controller0.showPickingAxis(true) theTeleporter.activate() def trigger0Released(): global theTeleporter controller0.showPickingAxis(false) theTeleporter.deactivate() cmat = controller0.getWorldMatrix() rayOri = Pnt3f(cmat[3], cmat[7], cmat[11]) rayDir = Vec3f(-cmat[2], -cmat[6], -cmat[10]) pickResult = getSceneIntersection(-1,rayOri, rayDir) theTeleporter.teleport( pickResult[1], pickResult[0] ) def controller0Moved(): global controller0 global theTeleporter if controller0.isTriggerPressed(): cmat = controller0.getWorldMatrix() rayOri = Pnt3f(cmat[3], cmat[7], cmat[11]) rayDir = Vec3f(-cmat[2], -cmat[6], -cmat[10]) theTeleporter.deactivate() pickResult = getSceneIntersection(-1,rayOri, rayDir) theTeleporter.activate() theTeleporter.updateTeleportLocation(pickResult[1]) def prepareScene( controllerInit = False ): global controller0 global theTeleporter if controllerInit: initControllers = True if initControllers: controller0 = vrOpenVRController("Controller0") controller0.connectSignal("controllerMoved", controller0Moved) controller0.connectSignal("triggerPressed", trigger0Pressed) controller0.connectSignal("triggerReleased", trigger0Released) controller0.setVisible(1) look = theTeleporter.lookat() setFromAtUp(-1, 0.0, 0.0, 0.0, look.x(), look.y(), 0.0, 0.0, 0.0, 1.0) setOpenVRTrackingOrigin( Pnt3f(0.0, 0.0, 0.0)) prepareScene( controllerInit = True )
There should be a Matrix-Transform called "TelePoint" in the scene below which you can put some visualization for where you are going to be teleported.
Hope this is helpful for you.
Kind regards
Michael
Hello Michael
Awesome script!
Using this teleport script, whereabouts in the code could you say, upon doing each teleport, instead of remaining the way you face, have it snap the hmd to the 0.0, 0.0, 0.0 origin? I'm wanting the user to always be facing the vehicle no matter where you end up!
Many Thanks
Harry
The setFromAtUp call in the teleport function defines the orientation of the camera.
setFromAtUp( -1, newOriginX, newOriginY, newOriginZ, self._lookAt.x() - newOriginX, self._lookAt.y() - newOriginY, newOriginZ, 0, 0, 1 )
You basically need to change the self._lookAt.x/y() - newOriginX/Y lines to match your needs.
Hello,
I'm trying to use this script, but it doesn't work correctly. The telepoint node stay under my controller when I pull the trigger to aim a teleportation point.
Any idea ?
Nice one, thank you!
Also, sorry for all the questions - is there a way to set up a bounding volume that stops you teleporting outside of a specified area? Say, a show room? I've activated collisions on the camera and such and it does stop you sometimes, but you can still get out of the environment in our scene.
Thanks!
Harry
Have you named the node correctly to "TelePoint"? It is important that the node exists before the teleporter is created.
I would appreciate a clarification about setFromAtUp() used in the script.
newOriginZ = 0 setFromAtUp( -1, newOriginX, newOriginY, newOriginZ, self._lookAt.x() - newOriginX, self._lookAt.y() - newOriginY, newOriginZ, 0, 0, 1 )
I'm confused about why newOriginZ is set to zero in the teleport function.
Wouldn't that set the Z coordinate of the camera position to Z=0? In other words align it at the floor level. Shouldn't the Z position be the height of the HMD as nodeHMD[11]?
Yes, that is the floor level. You are not setting viewpoints, you are setting the origin of the tracking space. The whole tracking matrix is added to this offset.
Thanks for the quick reply.
On the other hand, if teleporting to a point where Z > 0, would the newOriginZ be
newOriginZ = pick.z()-nodeHMD[11]+pos.z()?
For some reason I'm not getting the desired result.
I changed other parts of the code to take into consideration the z coordinate.
Hi,
Sorry for bringing up such an old post.
Did you ever manage to get the Z positioning working as I have now got this exact issue.
Best Regards
This is a very educational post, Michael's coding are very helpful on creating the teleport function for me.
And I do have the same concern, what should I do to teleport to places where z>0?
Is there any update on this topic?
Thanks everyone.
Why are you not using VRED 2019.2 or higher? We have added a couple VR OOTB features like laserpointer, vr menu and teleport. With this teleport you can choose if you want to teleport on objects or ground and can offset the ground level in the preferences.
Hi Seifert,
Thanks for letting me know about the updates, I just updated VRED, for you teleport function. I wonder, is it possible to customize the buttons rather than using the default touch pad to activate the teleport arc?
Thank you.
Yang
@seiferp wrote:Why are you not using VRED 2019.2 or higher? We have added a couple VR OOTB features like laserpointer, vr menu and teleport. With this teleport you can choose if you want to teleport on objects or ground and can offset the ground level in the preferences.
The problem with the teleporter in Vred 2019.2 is that any custom VR script I write overrides it, and I can't get it back.
Is there any setShowTeleportArc function that should fix this? I can't find anything.
Can't find what you're looking for? Ask the community or share your knowledge.