Springs behaviour under different Gravity values

Jul 3, 2010 at 11:08 AM


I'm trying to construct a game prototype where the object controlled by the player has the ability to control gravity.

The ability is applied only to himself, therefore all other objects in the world continue behaving the same.


In order to do this i've extended the Body class with it's own Gravity field, and updated PhysicsSimulator to get this field while doing the Update.


I'd like to prototype different behaviors with objects, such as Springs for example.

From what i've seen, the spring behaviour is not changing according to the Gravity value that the player has, why is this ?


I'd like the spring's collision with the player to be influenced by the Gravity vector that the player's Body currently has (allowing higher/lower jumps using the Spring).


How can this be achieved? am i missing something ?




Jul 9, 2010 at 4:30 PM
Edited Jul 9, 2010 at 4:56 PM

If all you want to do is jump higher, etc, why not just change the mass, or the amount of force you are applying for your jumps, much easier, same effect. Am I missing something here? At any rate, post exactly what you want the player to be able to do, and people might be able to help you make it happen.. (ie, Jump higher, Levitate, whatever..)

Edit: You could also set the ignore gravity flag on, then apply a constant downward force, simulating gravity, you can then adjust that value, lowering it for higher jumps, increasing it for lesser jumps, or even reversing it for negative gravity, allowing the player to hover or even fly(You probably wanna turn the ignore gravity flag back off when the switch to negative gravity occurs to keep the player from flying off screen..)...

(This sounds closest to what you want, but it's hard to tell, so clarify your goals, if this isn't what you need..)