So I’ve set up a VR character along with 2 motion controllers and a laser pointer via particle effects to the right hand controller. I also have another blueprint actor placed on the floor as my teleport object, so that when I aim the laser pointer at and hit the trigger, it teleports me to it. Everything works as expected so far, but I noticed that if I physically begin to walk around the live space and then trigger the next teleport area, it will teleport, but I will be standing outside or inside the walls in certain areas instead of being centered on the destination. If I actually don’t physically move and teleport around, then it’ll be fine.
How do I teleport both the player pawn and the headtracking position together so that I end up perfectly on my destination?
Here’s how I set up my blueprint so far
Hi Don -
There are a couple of ways to solve this.
The first, and simplest, is to call Reset Orientation and Position after you teleport, which will recenter you at your current position, and treat that as the new zero. That will prevent you from being offset and in a wall.
However, that’s probably not what you want! When you teleport, you probably want to take into account the maximum range of the player in their physical space, and not let them teleport into an area that they would be able to walk outside the wall in. The problem with Resetting Orientation and Position is that if you do that, the player will feel like they’re centered in their virtual space after they teleport, but in the physical world, they’re still standing next to a wall. I’d recommend when you teleport, you prevent teleportation to areas that are too close to walls by doing a collision test on the destination, and disallowing if it fails.
Hope that helps!
I took a look at this and it appears that the issue is coming from your camera pivot being in the center of your capsule collision. SteamVR’s is using a camera position is based off of it’s calibrated floor posiition, which once offset from the middle of the floor adjust capsule position puts it way up into the air. If you instead put you camera position at the base of your capsule(in HTC_Vive_Character w/ -90 on Z) you should start out where you would expect to be. You can then remove your Reset position calls on teleport and everything should work out. Does that make sense?
Thanks for the response. It definitely helped and got me on the right track. It does what I want it to now, but it also makes my character height a little bit shorter than what I have set up on in my VR pawn.
If I go back into my character pawn and adjust the camera that is attached to the scene component (followed steps from https://docs.unrealengine.com/latest/INT/Platforms/VR/VRCameraRefactor/index.html), and teleport, then it seems to have solved the problem.
However, if I reload my project and go into VR Preview for the first time, my character height will now be too tall now from having adjusted the camera height- until I begin teleporting. After the initial teleport, my height will be correct.
How would I go about fixing this? On my level blueprint, I’ve tried doing an Event BeginPlay → Set Tracking Origin to both eye and floor, but it seems that whenever I call Reset Orientation and Position after a teleport, my height changes. How can I keep it consistent?
I just wanted to follow up again on the issue with using Reset Orientation and Position, it causes a shift in my character height. I was wondering how to work around that issue. Thanks again!
I tried adjusting the player start as suggested, shown in the screenshots. It didn’t seem to do anything. I also tried lowering it as far as it could go before falling through the world, and the height a bit high - until the first teleport that adjusts it.
My workaround it for now is starting off in a completely different area enclosed by a sphere or box that would act as a title screen. The teleport from there to the interior starting point will have adjusted to the corrected height.
If you do reset orientation with the Orientation only as the parameter, does that work without changing your height?
It sounds like the problem with the VR preview might be a bug with the previous base height getting loaded in. We’ll have to fix that up on the engine side, but it might just go away if you try Orientation Only for the reset. Alternatively, you could call Reset Orientation and Position on BeginPlay in your pawn to make sure it’s always set on level start.
I can confirm that changing just the orientation does not change my height when I teleport. Before I was just resetting position because I wanted to keep orientation.
Your other solution works though, to add the Reset Orientation and Position on BeginPlay for my pawn. I didn’t know this, and was adding this to my level blueprint before, and it didn’t work. It makes sense now, so thank you for your help!
Edit: oops j/k :(. I closed and opened the project again and went into VR Preview and my height was offset again, even though I added a Reset Orientation and Position to Event Begin Play in my pawn. If I go into VR preview the 2nd time and so on, everything works fine. It’s just that very initial time I go into VR preview after opening a project.
I also did a packaged build and my height it off when the demo starts, but is fine after I teleport around. Strangely the Reset Orientation and Position (and also just Orientation) on BeginPlay doesn’t seem to fix it as we expected it to.
Out of curiosity, if you lower your player start so it’s halfway through the ground, does it work?
It sounds like there might be a disconnect between your pawn’s collision height and origin with where it’s starting.
Glad you got a workaround! If you’d like us to dig in to the original problem, could you give us a simple repro of your problem (Pawn Blueprint, set up in a blank test map with your teleport code?). Thanks!
Thanks Don! I’m currently traveling for business, but I’ll check this out when I’m back in the office with access to a Vive.
Hi Chad, thanks for the info. It makes sense and I will give this a try when I get a chance!