Hi,
My first question is not Box2D specific, but... a reply to this may be of benefit to others. So, I will ask it here in the hope of a solution.
1) I am creating a top-down game that has a ball at the main character. The playing field is made using Box2d for collisions and the movement of objects and contains no gravity (as it would be expected in the Z, though there is not need to worry about it). The ball that the player controls modifies the X/Y velocities for movement and uses linear damping to come to a rest. The problem is that I want the ball (a 3d model) to rotate in the direction of movement based on the velocity. The ball has no frictional surface (well, no surface at all) for which to gain any rotational impulses and thus must be manually added. My problem is finding a way to rotate the model along x/y based on the x/y velocity. Nothing I try works. Any help with a formula for this would be wonderful.
2) I have objects in the game world that act as bumpers. Ie. if the player makes contact with them, then the player is repelled. These are simple rectangular bodies and I am manually forcing the player away. Is there any way a body can be given a minimum restitution. ie. if I set a restitution on the bumper and allow box2d to handle the rebound, if the player keeps pushing into this bumper - eventually the ball runs out of steam and stops. What I would like to do is make sure it is repelled at the correct angle at a minimum amount of force set by myself. If there a simple way to do this?
3) What is the simplest way to find the amount of force that that a body collided into another with? Again, I am doing this manually, but know that Box2d has this information. For example, if the player hits another body hard enough, I want that body to crumble.
ps. sorry if I have not explained well enough (sneakily typing whilst at work 😉 )
My first question is not Box2D specific, but... a reply to this may be of benefit to others. So, I will ask it here in the hope of a solution.
1) I am creating a top-down game that has a ball at the main character. The playing field is made using Box2d for collisions and the movement of objects and contains no gravity (as it would be expected in the Z, though there is not need to worry about it). The ball that the player controls modifies the X/Y velocities for movement and uses linear damping to come to a rest. The problem is that I want the ball (a 3d model) to rotate in the direction of movement based on the velocity. The ball has no frictional surface (well, no surface at all) for which to gain any rotational impulses and thus must be manually added. My problem is finding a way to rotate the model along x/y based on the x/y velocity. Nothing I try works. Any help with a formula for this would be wonderful.
2) I have objects in the game world that act as bumpers. Ie. if the player makes contact with them, then the player is repelled. These are simple rectangular bodies and I am manually forcing the player away. Is there any way a body can be given a minimum restitution. ie. if I set a restitution on the bumper and allow box2d to handle the rebound, if the player keeps pushing into this bumper - eventually the ball runs out of steam and stops. What I would like to do is make sure it is repelled at the correct angle at a minimum amount of force set by myself. If there a simple way to do this?
3) What is the simplest way to find the amount of force that that a body collided into another with? Again, I am doing this manually, but know that Box2d has this information. For example, if the player hits another body hard enough, I want that body to crumble.
ps. sorry if I have not explained well enough (sneakily typing whilst at work 😉 )