I have created a very small FPS scene with a BSP box and a static mesh actor (with physics) on top of it. All I would like to do is pick up the actor when the left mouse button is pressed, and then put the object back down in its original position and rotation when the left mouse button is released. I though for sure my setup would work, but The object does not return to its original place, instead it is dropped or teleported to the floor.
I obtained the original position and rotation of the object from the “hit actor” result of a line trace and then used those to teleport that object when LMB is released.
Can anyone figure out where my mistake is made?
Thanks!
Sorry, not sure how to fit the image into the post…
Try setting simulate after moving the mesh back. Also I have never used the teleport node. I suppose it should work but if it doesn’t maybe try “set world location” or “set actor location” depending on what kind of object reference you have.
maybe this will help.
at event begin play, set object’s position into variable designed just for that - to store original position. then at desired moment, set object position from that variable.
in my case it looks like this.
RyanB - I tried adding the physics simulation after the movement and the object still only drops to the floor. I also attempted SetWorldPositionAndRotation and SetActorPositionAndRotation and the same thing happened with teleport. Any other ideas? This really has me stumped.
Harcarik - Thanks for the idea, but I feel like grabbing the object’s position and rotation need to be done after the line trace because there will eventually be multiple “grab-able” objects in the scene, so the location and rotation variables will be changing up all the time depending on which actor is clicked on.
Thanks mandango, that definitely helped! I added a DetachActorFromActor after button release and I saved the location and rotation variables directly after the line trace instead of at the end. The object now goes back to it’s original location and rotation like I wanted! One problem I’m noticing is the physics momentum still takes effect even after the object teleports back, so if I’m spinning around and let the mouse button go, the object will teleport and then continue rolling. Does anyone know how I would reset the physics so there is no momentum after teleporting? Thanks
Thanks Yggdrasil! That’s exactly what I was looking for! After Set Simulate Physics, I added the linear and angular damping for the physics object and set them to 2000. No more extra movement or rotation!
I wouldn’t have a blueprint for it, but I believe it would go after the Teleport I believe. Drag off of Held Mesh (or object) and Set Linear Damping and Set Angular Damping.
Im sorry fro these questions but im still a bit new to vr development and blueprints.
I was trying different approaches to object interactions in mobile VR Oculus Go and the only one wich worked out for me was this tutorial https://academy.unrealengine.com/Class-Viewer/VR_Arch Part 3.3 - Interacting with objects.
so here are the screens of my current blueprints
Oculus Go Pawn -
Blueprint for interactable objects -
What i really need is to make objects return to there prepicked (default) position.
Lets say i have a model of a vehicle where you can take and inspect different separte parts of it, so what i whant is to make these picked objects return back to there initial positions, if possible with smooth transition on there way back or even with just a simple teleportation back.
Main problem is to return them back to where they were before the interaction.
As far as i can understand i need to collect the world position data of an object before it is picked and then implement it to the new position after an object is released, but i cant understand how,with what nodes and where should i put them…
please help!
You would need to store their position and orientation in variables, perhaps after they are spawned into the world (Begin Play). Wait a second or two and save their position and orientation in variables that you would reference later when they need to be returned to their previous position.