Jump to content

Rolling a circle down a hill?


schmevie15
 Share

Recommended Posts

So currently I am making a 2D game with Phaser P2 Physics that involves a ball rolling along, sort of like a platformer, I am trying to make it both difficult for the ball to roll up a hill and then easy for it to roll down. I know increasing the gravity will do the trick, but then the global gravity will be increased and the ball will basically be sucked to the ground. I've performed some tests and I had to change the gravity to about 10000 to get it to roll down at a noticeable speed. Now is there an easier/better way to do this using some of the Phaser P2 Physics attributes? I appreciate any and all help!

Thanks! 

Link to comment
Share on other sites

if you give the ball a constant force this force will always work against you.. what if the ball should roll down on the other side of the hill??  constant force would make it roll UP the hill then..  why gravity ?  because it is  a physics simulation .. gravity is all you need!

 

 

look here for inspiration.. i just made a small example for you without materials..  (materials are still a good idea to make it feel more real give it a little bit of friction)

 

http://test.xapient.net/phaser/ballhillrolldown/

Link to comment
Share on other sites

Hey thanks for the replies guys! I figured gravity was the answer. @valueerror, where are you setting the gravity? I see that you set the global gravity to be 1400, but you don't seem to change it after that. Are you giving the ball gravity or increasing the global gravity anywhere? Thanks for the help!!

Link to comment
Share on other sites

Hey thanks a lot! I have a question though, it rolls fine now, but if I try to rotate while rolling down the hill it reverts to the speed of the rotation, the rotating doesn't contribute to the speed it's going at already. Also thanks for the pyramid advice I was looking for something like that I remember in ARCADE physics it was something like immovable! Thanks!!!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...