Grabbed objects get stuck

In my project the player has the ability to teleport between levels,
he can also pick up physics object in the world and teleport with them,

the issue is that when the player teleport with something in his hands it tends to get stuck between levels, and i don’t know how to fix this

Ps: the levels are layered on top of each other

252040-stuck.gif

Thanks for any help!

What do you mean stuck “between” levels?

You should take care to teleport the stuff in his hands and the hands themselves too. (manually)

Now how you do it depends on your particular teleport mechanic. Maybe you can just store it and re-set their positions. Maybe you should destroy and re-spawn them after the teleportation.

You can save the object, and on begin play Spawn it again and attach to physics handle again

Thanks, this is my current solution although if there’s lag in the game it can sometimes still get stuck

Sometimes the object that the player is holding can get stuck underneath the floor

Yea, only when i teleport, because the player teleports to the floor above, and the object tries to follow. i fixed this by setting the world location of the held object when the player teleports. However objects can still get stuck in between floors sometimes if theres lag.

The object get stuck underneath the floor when teleporting or there is no relation?

When you set the Location of the held object, remember to turn off the Sweep option.

Yup, sweeping is turned off

You can try releasing the object, teleporting it in front of the character, and then immediately grabbing it again. Maybe the physics handle trying to pull the object somehow interferes with the teleportation.

ooh, good idea, i’ll try it out

Thanks, this helped me understand how physics handle works.

If you are holding an object. Save a reference to this PrimitiveComponent and its Actor.
When you teleport, make sure to set the world location of the held object to the desired held object location.

You can call SetWorldLocation on the primitive component.

  • Swept: False
  • Teleport: True

Or you can call Teleport on the held object’s actor if the physics component is the root of the actor.

To prevent objects from getting stuck in the floor, I often teleport them to a location higher than the floor, then have move them down to the desired location in Z, with Sweep option on. This is similar to placing an object in the editor, then tapping the “end” key, although it won’t place them so far down as that if there’s no floor for a long way.