Advertisement
orfeasel

Applying Radial Impulse to Actors

Dec 26th, 2015
5,799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1. //Get all the nearby actors
  2. for (auto It = NearbyActors.CreateIterator(); It; It++)
  3. {
  4.     //Get the static mesh component for each actor
  5.     UStaticMeshComponent* SM = Cast<UStaticMeshComponent>((*It)->GetRootComponent());
  6.  
  7.     /*If the component is valid, apply a radial impulse from the location of the "Bomb" Actor
  8.     having as Radius and Strength the values from the Editor.
  9.     The RIF_Linear impulse fall off parameter means that we want the impulse to fall off to zero when
  10.     the max distance is reached.
  11.     The last parameter means that we want to ignore the mass of each Static Mesh*/
  12.  
  13.     if (SM)
  14.     {
  15.         SM->AddRadialImpulse(GetActorLocation(), Radius, Strength, ERadialImpulseFalloff::RIF_Linear, true);
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement