Why Actor not moving with setActorLocation

Hello everyone,

I’m beginner with UnrealEngine, and i’m wondering why when i use setActorLocation does not move the staticmesh(ball);

Context:

I’m creating small Soccer Game (for learning UE5),
I created BluePrint class(Actor) in it i added sphere Mesh (root → sphere)
so when i add setActorLocation and add value (ex x=100,y=200,z=0) when i execute that the sphere stays in original coordinates (0,0,0) but when i print returned value of getActorLocation i got (100,200,0).
when i use setWorldLocation & getWorldLocation its does work.

The Question is why getActorLocation and SetActorLocation not working for static mesh, because i tried them on Character BluePrint Class they work as charm.

Sorry for my english :slight_smile:

Is the ball simulating physics?

you’re moving the root component not the ball, normally they’d be attached but like Everynone said if physics is enabled it wont work.

short version, make the mesh the root component

Thank you guys for replying, after some diging i found the reason why, When an object is set to simulate physics in Unreal Engine, it’s typically governed by the physics engine rather than direct positional changes. This means that using setActorLocation directly won’t have an effect because the physics simulation is overriding it.

Instead, if you want to move an object that simulates physics, you’d typically use forces, impulses, or velocities to influence its movement within the physics simulation. This way, you’re interacting with the physics engine in a way that aligns with its behavior.

SetActorLocation does work, just has to be on the correct component

This is not true. The physics is not overriding anything. The simulated elements are simply no longer relative to the actor. Nothing stops you from setting Component location:

It can also account for physics.