The actor in question (ShotCam) has a GrabComponent to also enable the user to grab the object.
The script works perfectly until the player grabs the actor.
It no longer executes the teleport if the player has grabbed and moved the actor at any point.
Can someone help me out as to why this is happening?
Nothing different from the initial behaviour. It just teleports the first instance of the object around (until I grab it), and ignores the second instance entirely.
Could you check this post and make sure this is not related to physics simulation?
I created a dummy VR project with a ‘ShotCam’ actor that contain only a white sphere as a visual representation, and there your teleport BP code is working fine - as long as the ShotCam actor physics simulation is not enabled.
I’ve worked around this issue by using the ‘Set World Location and Rotation’ function instead of ‘Teleport’ and targeting the parent Static Mesh object within the actor instead of the actor itself. Not entirely sure why this works and teleporting the actor doesn’t after a grab, but oh well! It works!
But actually, I’m leaving this post unresolved for a few reasons:
-Changing from teleport actor to set world location doesn’t behave the same, for some reason. Set World Location teleports from the object’s center point, and teleport teleports the front of the object to the player pawn’s camera (which for my purposes, is the intended behaviour, as I don’t want to see the object directly infront of the camera).
-We still don’t know why Grabbing permanently disables the object from teleporting, and I’d love to know why to get the original functionality to work the same
The function ‘SetPrimitiveCompPhysics’ in the grab component is called every time you release a grabbed component.
You could check in the ‘TryRelease’ function if your grabbed item is the ShotCam actor and then call the ‘SetPrimitiveCompPhysics’ with ‘Simulate’ boolean set to false.
I’ve made the following addition to the TryRelease function, but unfortunately the behaviour has stayed the same. Unsure if I just handled this incorrectly or it truly has no effect on the problem.
In that case I would check if physics sim is disabled before the grabbing and if it’s enabled after. The behavior of the ShotCam actor is changing once it has been grabbed, so there must be something changed on the actor by the grab component.