SetActorLocation not working after toggling Simulate Physics

Hey, im not sure this is bug :slight_smile:

Two possible options:

One:

Your game is multiplayer game and runned with more client, in this case physics and physics simulated movement will be not replicated because engine can replicate simulated meshes if static mesh component are set as root of the actor!!! :slight_smile:

Two:

Im not sure, but physics simulated actors accepting mostly forces and direct setting location maybe ignored (im not sure about this)

But no worrie!!

Any case you have solution.

You need work with physics constraint actor/component!!
This is a simple actor ehich can tie and connect together two other actor/mesh and allowing swing/twist movement.
If base actor is not simulating physics, tied other actor will not fall to the ground, just swinging.

Short prof:
Constraint component to char, if interact happen attach interacted mesh to your constraint component, and mesh will follow your character :slight_smile:
And dont forget to set mesh as root in that interactable actor, just for sure.

Some further info:

Or and i totally forgot about this:

Ue have built in Physical Handle solution for this :slight_smile:

2 Likes

Im having some issues trying to move the object that has physics. Turning physics off makes the script work. But when i turn it on, it wont move/teleport where i want it to be.

So i have disabled physics at first, then reenable it with script, and disable it again, and that makes it not work again.

202089-1.png

By not changing the physics settings at all and keeping it off, makes it work. But from Enabled Physics to Disabled Physics does not work.

Here is a video of how it should work and what the problem is: - YouTube

Also, this script is in the player script.

Also, SetActorLocation does not work when Physics is already activated. Disabling Physics with script when Physics is default activated makes also SetActorLocation not work.

If Physics is already default deactivated, and remove Set Simulate Physics (true), it will work.

So, what i just did is putting Static Mesh Component as root. And changed the blueprint a bit, and it worked as intended. Thanks for that.

1 Like

Enabling Teleport or setting the teleport type in cpp fixes this for me.

This was bugging me for half a day! Changing the collision to be the child of the mesh worked for me. Cheers!

1 Like