Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Rabagast on September 06, 2014, 09:07:28 PM

Title: Gravity
Post by: Rabagast on September 06, 2014, 09:07:28 PM
Is it possible to have both normal gravity "Y -20" and gravity the other way like "Y 20" at the same time? For example if I have a character on the ground and a character on the roof.
Title: Re: Gravity
Post by: cloud03 on September 06, 2014, 09:53:01 PM
With 2D Rigidbody is quite easy to do this, you can set the gravity scale to a negative value, but with 3D Rigidbody there is no option to change the gravity scale. One way to do this by adding a constant force component to the GameObject, and insert a value on the y-axis to be greater than the gravity (ex: 19.6 , from 9.8 multiply by 2). I'm not sure is this actually physically correct, but I've tested it, and it does the job...
Title: Re: Gravity
Post by: Lane on September 06, 2014, 11:37:30 PM
Gravity is just a force of 9.81 on all rigidbodies on -y. Double it and push to +y and you'll have inverted gravity on select bodies. Basically like cloud described.
Title: Re: Gravity
Post by: Rabagast on September 07, 2014, 05:22:37 AM
Hi!

I can't have 2D Rigidbody on capsule. Does it need to be a flat 2D object?

Did you try with two objects at the same time, Cloud?
Title: Re: Gravity
Post by: cloud03 on September 07, 2014, 05:53:09 AM
yup, I've tested with two objects simultaneously, and it worked...here is the scene example..
Title: Re: Gravity
Post by: Rabagast on September 07, 2014, 06:37:20 AM
Thank you! I need to have a higher value on Constant Force, because one cube will be on the ground and the other cube will be on the roof. I didn't know about Constant Force, so thank you for that. :)

But I tried with add force also and checked every frame and that worked also very good. The ground object has Add Force -10 and the roof object has Add Force 10. :)