Can I change the gravity direction?
I know that I can invert the gravity to a negative value but what if I wanted it to point forward or backwards, left/ right? Also is there a way to do this in Blue Print?
asked May 13 '14 at 03:42 PM in Blueprint Scripting
I have done that by overriding UE4's gravity and creating my own. How?
I have certain stuff in my game that I want them to react on directional gravity, all of them are child of my "Obstacle" blueprint. This can be done in other ways in your case but I'll show you how I did it :) This "parent class" has one Vector3 variable "Force" and one colider with one value changed - Physics -> "Enable Physics" turned off (you need to click the small arrow down to unfold advanced settings if you can't see it). That prevents an object from being affected by standard one-value ZGravity of UE4. Of course "Simulate Physics" mustbe checked for the rest of physics simulation to work.
Next, in the events graph just run "SetPhysicsLinearVelocity" function every tick, so you can easily manipulate that value in the runtime:
Using this method you can try setting linear velocity to a variable in the Level Scope, so all object share the same value. Hope that helps!
Follow this question
Once you sign in you will be able to subscribe for any updates here