Multiple Physics in one stage?

I am curious if Corona is able to handle more than one physics property in a single level.

Let me clarify what I mean by this to say,

Let’s say you have a golfing game, where you hit the ball from the bottom of the screen to the top of the screen.

Then you cut the screenHeight in half.

Where you now have 2 wind directions that you want to have affect the golf ball.

If you’re below the 1/2 Y mark the wind is +x

and if you’re above the 1/2 Y mark the wind is -x

Is this something that has been done before in Corona, is it even possible to have it done.

I’m thinking where you set gravity on the bottom half to like (4, 0)

and the top half gravity is (-8, 0)

I would apply the wind as a force.  You can monitor the position of the ball and then apply the necessary force or impluse for the change in wind.  You probably shouldn’t mess with the gravity.

Thank you for the reply Rob,

So once the gravity’s been set it’s not a good idea to start tweaking it?

I’ve seen some games where you can make the gravity go up instead of down, like in that ball bouncing game Bubble Ball.

I will give impulse and force a try.

It depends on what you want to do.  In most physics games you want to have earth physics on, so not changing physics makes sense.  But if you want floating things, you would perhaps set a per object physics.  But in a golf game, the ball needs to maintain earth physics so that it will go up and down at the right rate.  If you want to apply other forces like wind, then  you need to use the force controls to apply it.

Rob

Hi @PickionGames,

If you want to handle two “views” in a game, one with gravity and one without, you might be able (depending on your design) to simply set the master gravity to earth gravity, but then set the gravity scale of some objects to 0 such that they won’t be affected by it:

http://docs.coronalabs.com/api/type/Body/gravityScale.html

Also, remember that body types of “kinematic” will not be affected by forces, including gravity.

Hope this helps,

Brent

Thank you Rob and Brent,

Going to play around with that, I remember running into gravity scale before it might be something I can play around with.

Sincerely,

Harry Tran

I would apply the wind as a force.  You can monitor the position of the ball and then apply the necessary force or impluse for the change in wind.  You probably shouldn’t mess with the gravity.

Thank you for the reply Rob,

So once the gravity’s been set it’s not a good idea to start tweaking it?

I’ve seen some games where you can make the gravity go up instead of down, like in that ball bouncing game Bubble Ball.

I will give impulse and force a try.

It depends on what you want to do.  In most physics games you want to have earth physics on, so not changing physics makes sense.  But if you want floating things, you would perhaps set a per object physics.  But in a golf game, the ball needs to maintain earth physics so that it will go up and down at the right rate.  If you want to apply other forces like wind, then  you need to use the force controls to apply it.

Rob

Hi @PickionGames,

If you want to handle two “views” in a game, one with gravity and one without, you might be able (depending on your design) to simply set the master gravity to earth gravity, but then set the gravity scale of some objects to 0 such that they won’t be affected by it:

http://docs.coronalabs.com/api/type/Body/gravityScale.html

Also, remember that body types of “kinematic” will not be affected by forces, including gravity.

Hope this helps,

Brent

Thank you Rob and Brent,

Going to play around with that, I remember running into gravity scale before it might be something I can play around with.

Sincerely,

Harry Tran