Here's how you can turn gravity on or off for a KActor or any RB Physics based object
I use this code so I can simply press a button to toggle gravity for my rolling WASD controlled KACTOR ball.
You can do this as many times as you want during gameplay!
put this code in your KActor class
use this code to turn gravity off for your KActor class at time of game-start:
enjoooy!
(You don't have to use Self but I am using it for reading Clarity)
♥
Rama
I use this code so I can simply press a button to toggle gravity for my rolling WASD controlled KACTOR ball.
You can do this as many times as you want during gameplay!
put this code in your KActor class
Code:
function gravityOn(){ ( Self.StaticMeshComponent.GetRootBodyInstance() ).CustomGravityFactor = 1; } function gravityOff(){ ( Self.StaticMeshComponent.GetRootBodyInstance() ).CustomGravityFactor = 0; }
use this code to turn gravity off for your KActor class at time of game-start:
Code:
Simulated Event PostBeginPlay() { super.postbeginplay(); gravityOff(); }
(You don't have to use Self but I am using it for reading Clarity)
♥
Rama
Comment