Advertisement
orfeasel

Applying Impulse to an Actor

Dec 26th, 2015
9,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. void AMyProjectCharacter::MoveChosenActor()
  2. {
  3.     //Get the static mesh of the chosen Actor
  4.     UStaticMeshComponent* SM = Cast<UStaticMeshComponent>(ActorToMove->GetRootComponent());
  5.  
  6.     //If the static mesh is valid apply the given impulse
  7.     if (SM)
  8.     {
  9.         /*When you want to apply an impulse you always need to multiply it's value by the
  10.         mass of the object that the object is applied to.*/
  11.         SM->AddImpulse(ForceToAdd*SM->GetMass());
  12.  
  13.     }
  14.     else GLog->Log("Root component is not a static mesh!");
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement