Skip to main content
2 of 11
edited tags
Evorlor
  • 5.9k
  • 9
  • 59
  • 101

How do I RigidBody.AddForce(Vector3) in Unreal Engine?

I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4. I want to add a one-time force to an object. To accomplish this in Unity 5, I would use:

void Start(){ GetComponent<RigidBody>().AddForce(new Vector3(0, 0, 5)); } 

The force would be applied to the RigidBody (a component of the GameObject), and the object would move forward on its z-axis.

How would I accomplish this same thing in Unreal Engine 4? I currently have an empty AActor script, and I am struggling to find out what to put in my BeginPlay() method.

void AMyActor::BeginPlay() { Super::BeginPlay(); //What goes here? } 
Evorlor
  • 5.9k
  • 9
  • 59
  • 101