2 Questions about smashers and 2d physics
Posted: Mon May 07, 2012 7:13 pm
Hello,
i have a two part question about your most excellent physics engine
which i use in my 2d-scroller:
1. In my game i have a couple of cliche smashers. What is the best way to detect if my ship is smashed? Is there a way to find out how much pressure is effected on an entity? Or should i check if the ship has contacts with both the smasher and the wall? My guess is that the latter won't work everytime and the ship gets catapulted away (which is what happens right now)., Can you suggest a better way?

2. To achieve 2d I set position, and linear velocity to the XY plane which works flawlessly so far.
I also attempt to limit the rotation by zeroing the second column of the LocalInertiaTensorInverse and setting AnguilarVelocity like this:
which works most of the time.
However, sometimes when flying into an opening door or hitting an enemy the ship is still rotated and points to the back or front:

Do I have to zero the LocalInertiaTensorInverse every frame? I guess there is still some angular momentum coming from an off-center contact or something? Is there a way to prevent this?
Thanks for taking the time to read my questions!
Best Regards,
Christian
i have a two part question about your most excellent physics engine

1. In my game i have a couple of cliche smashers. What is the best way to detect if my ship is smashed? Is there a way to find out how much pressure is effected on an entity? Or should i check if the ship has contacts with both the smasher and the wall? My guess is that the latter won't work everytime and the ship gets catapulted away (which is what happens right now)., Can you suggest a better way?

2. To achieve 2d I set position, and linear velocity to the XY plane which works flawlessly so far.
I also attempt to limit the rotation by zeroing the second column of the LocalInertiaTensorInverse and setting AnguilarVelocity like this:
Code: Select all
Vector3 angVel = Vector3.Zero;
angVel += new Vector3(0, 0, TurnThruster * TurnSpeed);
Entity.AngularVelocity += angVel;
However, sometimes when flying into an opening door or hitting an enemy the ship is still rotated and points to the back or front:

Do I have to zero the LocalInertiaTensorInverse every frame? I guess there is still some angular momentum coming from an off-center contact or something? Is there a way to prevent this?
Thanks for taking the time to read my questions!
Best Regards,
Christian