box2d游戏提示

I don't know well since I choose to use a Physics engine to process every interactions in my world.

Why not trying to set a large amount of mass for your player and a very tiny mass for others objects.
Then setting global gravity with 0,0 and processing each objects with a custom ApplyForce.
Tweaking player and objects friction.
Use contact points to control collision against wall and all others objects.

There is no SetPosition method for b2Body only with b2BodyDef.
RE-Creating each frame the body may not be the best solution... But who knows !

Box2d is based on Impulsion forces so it should be possible to reach such a result by tweaking objects values.

All depend on the way your player is moving and the forces applied to others objects (gravity, force, torque, etc.)

Another solution would be using sensors.
A sensor is a shape that detects collision but does not produce a response.
Add 2 shapes by object.
Set the first one as a sensor and add a collision mask to the second one in order to prevent collision with main character.
Then all you have to do is applying impulse / force to the object when is sensor overlap the main character.

Don't forget there is a Box2D forum (  http://www.box2d.org/forum/  ) to ask question relative to Box2d itself ;) 

你可能感兴趣的:(box2d游戏提示)