Platform physics - best approach?

Hi,

I am building a platform game but I can’t manage to get the exact feeling of the “hero” when he jumps around on the platforms etc.

So my question is, are there any generic rules I can follow to make my object behave?

The physics has all it settings and how much gravity should I apply? I am using 10 right now.

And for the character I am setting, density = 0.8, friction = 0.6, bounce = .4

Any suggestions or comments are welcome!

Joakim [import]uid: 81188 topic_id: 20745 reply_id: 320745[/import]

I’ve ran into a ton of these type of issues with my current game. How are you making your character jump? Transition to? Applylinearforce? Applylinearimpulse? Are you adding this line to your platforms object.isPlatform = true?
[import]uid: 46082 topic_id: 20745 reply_id: 81511[/import]

For jump I use: :applyLinearImpulse( 0, -6, ball.x, ball.y )

and for movment in x I use: ball:applyLinearImpulse( event.joyX/3, 0, ball.x, ball.y )

Any suggestions?

Joakim [import]uid: 81188 topic_id: 20745 reply_id: 81512[/import]

It could be a collision problem. Check this page out. It helped me with a HUGE problem my game was having.
http://developer.anscamobile.com/forum/2011/02/07/physics-bodies-and-joints-no-collision-detection [import]uid: 46082 topic_id: 20745 reply_id: 81519[/import]

Collisions problems? No, theres nothing wrong with my code and I just wonder what the “physics” world should have for settings…

Joakim [import]uid: 81188 topic_id: 20745 reply_id: 81520[/import]

Sorry, misunderstood. What do you have your gravity set to? “Real” world gravity you would set “physics.setGravity(0, 9.8)”, to get the desired “real” effect. Then you would just have to play with your players physics to get the desired result. You’re probably already doing that though. Sorry I can’t be more help. [import]uid: 46082 topic_id: 20745 reply_id: 81522[/import]

Yes, I am having 9.8 in gravity :wink:

Sorry, no problems!

Joakim [import]uid: 81188 topic_id: 20745 reply_id: 81525[/import]

Just to chime in. I think the physics settings are also dependant on the dimensions of your character so the larger the character the heavier the object so some other persons physics settings might not work in your situation.

The best thing to do is just set your characters dimensions and don’t change them and then play with the density of your character till you get the right feel with jumping etc.

Hopefully that made some sense.

[import]uid: 33866 topic_id: 20745 reply_id: 81527[/import]

Yep, I guess that there is no quick solution to this - I will do a trial and error :slight_smile:

Thanks, Joakim [import]uid: 81188 topic_id: 20745 reply_id: 81534[/import]