TeleportTo AlignRoomWithSpawnPoint has problems if there's a wall between the destination origin and player position
tracked
aurycat
My understanding is that when using AlignRoomWithSpawnPoint with TeleportTo in VR, the passed position/rotation is the destination playspace Origin position/rotation. It's as if the playspace Origin tracking point is moved to your given position, and the player is moved along relative to the Origin. The new origin might be outside a wall, while the player is inside that wall, but that shouldn't matter.
However, I've found that if after teleporting a player in VR using AlignRoomWithSpawnPoint, the new player position after teleporting is separated from the new origin position by a wall, the teleport will usually "break". The player's
head
/viewpoint will end up at the correct position, but they will be detatched from their avatar, which will be outside the wall.This happens when the wall collider is double-sided, i.e. there is collision between the new origin and new player position which seemingly prevents the player capsule from moving to the correct spot.
I have made a (contrived) example scene to demonstrate the issue. There is a box, a button which teleports you into the box using AlignRoomWithSpawnPoint, and two indicators. The green indicator shows your AvatarRoot tracking position/rotation, and the magenta indicator shows your Origin tracking position/rotation. When you click the button, the green indicator animates from its position under you to the target position inside the box. The magenta indicator also moves along relatively to the green indicator. At the end of the animation, the magenta indicator should be the new origin position/rotation after teleporting, and so it is the position/rotation passed to TeleportTo. If AlignRoomWithSpawnPoint behaves correctly, you should be teleported into the box and your green indicator should remain underneath you.
In the attached video, you can see the first two teleport attempts work correctly. The 1st teleport I stood at the origin, so everything worked fine. The 2nd attempt, the origin was outside the box, but the teleport still worked, and to be honest I don't know why that time it worked. But the 3rd and 4th attempts both failed: my head was teleported into the box, but my avatar stayed outside the box, and the green indicator was outside the box too. I didn't have to jump over the wall to rejoin my body -- I could just pass right through it.
Here is a package containing the example scene:
Of course, the workaround here is to just teleport using Align
Player
WithSpawnPoint, which uses the AvatarRoot position. That's fine and all, but since I encountered this bug and spent days trying to figure out what the heck was happening, I figured I'd report it!Thanks!
Log In
This post was marked as
tracked
Fax
marked this post as
open
Thank you for the detailed reproduction steps!
aurycat
Hiya, Fax! I was able to reproduce the same bug when teleporting from Update, FixedUpdate, LateUpdate, PostLateUpdate, SendCustomEventDelayedFrames callback with Update timing, SendCustomEventDelayedFrames callback with LateUpdate timing, and a SendCustomNetworkEvent callback.
(The SendCustomNetworkEvent callback probably isn't useful because I'm testing with just one player, so the callback is invoked synchronously with the SendCustomNetworkEvent call. Oh well, I tried!)
So, the bug happens at all event timings as far as I can tell.
Here's an updated UnityPackage containing the code modified to test at various event timings:
Fax
marked this post as
needs more information
Hi aurycat! Thank you for reporting this issue.
If I remember correctly, issues like this only occur when you try to teleport players at a specific time - e.g. in response to a network event.
Can you please confirm the event timing of this issue? (Update/FixedUpdate/Callback/etc)