BobDylan Posted September 23, 2014 Share Posted September 23, 2014 I'm trying out the P2 physics engine, but I'm thinking I only need physics enabled for the y-axis. For example, a car-sprite that moves from left to right on a bumpy road. I would like the car to bounce up and down, when there's a bump in the road, but it needs to maintain a constant horizontal movement, and no weird collisions that make the car move left or or extra to the right. Is this possible with P2, or should I use Arcade physics (or maybe no physics engine after all) ? Link to comment Share on other sites More sharing options...
lewster32 Posted September 23, 2014 Share Posted September 23, 2014 I'd probably say this is an Arcade or non-physics thing, and I certainly wouldn't rely on collisions producing the effects you want. If you're trying to force physics to behave in a very specific and non-intuitive way, you're probably going to end up doing more work than is necessary. Although it's unnecessary (Arcade physics will do pretty much the same thing as this) It'd be pretty easy to create a routine which causes the car to jump into the air, fall back down and bounce a bit without using Phaser's physics at all: http://jsfiddle.net/lewster32/kc9Lz2xy/ Link to comment Share on other sites More sharing options...
Recommended Posts