SteamVR Teleport onto moving object
Hello community
I am trying to teleport onto moving objects using the provided SteamVR Teleport prefab, teleport areas are working fine, but I don't know where the events for Teleport are located or how to parent the Player prefab to the hit object correctly using the normal vector of the teleport area? (an object could have a valid areas on the bottom).
I have a plan I intend to try, going to place a trigger at the players feet, when it hits a new object it tests to see if is a new object containing a teleport area, the sets that as its parent, then set the player rotation to match the teleport areas surface normal as UP.
Good idea? or is there already a script in the SteamVR tools?
Thanks for any advice in advance.
This plan to parent the player has not worked, S$$anonymous$$mVR Teleport breaks if the player prefab is parented to anything?
Answer by SEVO · Mar 15, 2019 at 02:59 PM
So here is an update, I have been editing the stock SteamVR scripts just to figure out a quick and dirty solution:
Parenting the SteamVR Player prefab only breaks if the parent is set inactive, no crashes, it just turns off the camera. I did this in Teleport.cs -> TeleportPlayer(), I got the teleport area's transform (inactive) and then got it's parent transform, then parented the player to that.
Player prefab can be effected by local scale of parent transform, be sure to either have a parent with 1,1,1 scale or to do the "player.trackingOriginTransform.localScale = player.trackingOriginTransform.localScale;" trick, this seems to allow the Player prefab to maintain it's own scale (it works, don't know why).
You can set the player's rotation on the new parent by grabbing the rotation of the teleport area and setting the player.trackingOriginTransform.rotation to be the same, this needs to be world space rotation!
Turn of the teleport arc gravity to prevent weird issues cause by the player now being stuck to walls, there is no toggle, in Teleport.cs find the teleportArc.SetArcData() method and change the gravity argument to false, it's a quick fix.
You can also fix the orientation of the target point of the teleporter in Teleport.cs in the UpdatePointer() method, I copied the orientation check from the invalid pointer. Using the same rotation on the PlayAreaPreview does work, but it also seems to spin it around the teleport marker very slowly.
This is not my final solution, it is very hacky and needs to be cleaned up, but it does work as intended. I will update my Repository and link here later, with the hacky code. I hope this inspires someone to do this better than me :)
Here is my repo, I cut out the space Skyboxes to save space, and they are not $$anonymous$$e to distribute: Git repository
Well now I'm stumped, I cannot override the S$$anonymous$$mVR scripts with neat extensions due to most of the functions being Private. $$anonymous$$y only working solution is modifying the existing Teleport.cs script :(
Your answer
Follow this Question
Related Questions
VR Teleporting on any object 0 Answers
Steam VR Teleport Reticle Off Set? 0 Answers
SteamVR Interaction system. Small problem with Teleport points. 3 Answers
Snapping Objects 0 Answers