Sure! Here’s the direct answer:
To give actor components velocity (for example, in Unreal Engine), you typically need to apply movement through a physics simulation. Actor components like a StaticMeshComponent or PrimitiveComponent have built-in functions to set velocity if physics is enabled.
Here’s how you can do it:
Step-by-Step:
-
Make sure physics simulation is enabled on the component:
YourComponent->SetSimulatePhysics(true); -
Set the velocity directly:
YourComponent->SetPhysicsLinearVelocity(FVector(1000, 0, 0));(This example gives it velocity in the X direction.)
Important:
- If
Simulate Physicsis off, setting velocity won’t do anything. - You can also add forces or impulses for more natural movement:
YourComponent->AddImpulse(FVector(1000, 0, 0));
Summary:
Enable physics simulation ➔ then use SetPhysicsLinearVelocity or AddImpulse to give it velocity.
Would you like a quick example in Blueprints too? ![]()
![]()