Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am fairly new to unreal engine and I would like to know how to set custom gravity in a specific point or area instead of down. For example I do not want the gravity pull to be down but more to the center of my level (center plane not center point) and that gravity to only affect specific actors. Other actors will be affected by normal gravity or affected by no gravity at all.

How can I do this? (blueprints or c++)

share|improve this question
up vote 3 down vote accepted

I know they're planning to un-hardcode Gravity [Source: I'm a moderator on the official Unreal Engine forums, I know things ;)] but the best way is to either add force in the direction you want or set the player to "Flying" mode and push him about with Launch character / Add force.

This is the only way without altering source code (Until they un-hard code gravity).

Tl;Dr - Fake it for now, A fix will come eventually!

share|improve this answer
    
by eventually what is the anticipated time? cause I am only at the start of my game. This is not one of the urgencies but I thought I should so I could comprehend and have a solution ready when I need it. If it's not in three years then I can wait for it – John Demetriou Jul 28 '15 at 7:49

You can not change the direction of the built-in gravity, it always points to the negative z-axis. You can also not change the gravity for single actors, only globally. But why do you need that, you can always just increase the mass of your actor.

You can easily turn off gravity completely for any actor, just look for "gravity" in the blueprint options of that actor.

share|improve this answer
    
Well I need specific gravity let's say In a 3D world I want the gravity to be the center plane of the world, items above that plane to be dragged down and items below that plane to be dragged up. – John Demetriou Jul 26 '15 at 20:39
    
is there no way to do that? – John Demetriou Jul 27 '15 at 7:08
1  
No, the z-axis gravity is hardcoded into the engine. You can of course write your own gravity code or change the engine code, but that will be one heck of a job. Look around the forums, some people played around with dynamic gravity, but the results are all glitchy and a lot of work. The gravity constraint really is one if UE4's weaknesses. – TheBrain Jul 27 '15 at 7:20
1  
Maybe I should just disable gravity and write a specific force that draws the object towards the plane more or less – John Demetriou Jul 27 '15 at 7:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.