Your project manager is planning to add more physics simulations to the game. He wants the UFO to rotate around its Y-axis. However, it must follow the physics laws and the rotation could occur while applying forces and/or impulses to the UFO. Hence, you must use the physics simulator capabilities to avoid buying a physics law book.
We are now going to use Farseer Physics Engine to add a torque affecting the UFO's rotation.
1. Stay in the project
3DInvadersSilverlight
.2. Open
Ufo.cs
.3. Add the following line of code before the end of the class' constructor:
Body.RotationalDragCoefficient = 0.2f;
4. Add the following line of code before the end of the
Update
method:_mesh.World = Balder.Core.Math.Matrix.CreateRotationY(FarseerGames.FarseerPhysics.Mathematics.MathHelper.ToDegrees(Body.Rotation));
5. Open
InvadersGame.cs
.6. Add the following lines of code in the
CheckKeyboard
method, before the lineKeyboardManager.RemoveUpKeys();
:if (KeyboardManager...