Have a position (Vector3) and rotation (Matrix) on your Object/Entity/Ship, and then you can use the following code sample to move or rotate it in any of its local axes.
For example, you want to roll an airplane 45 degrees (this is the rotation about the forward vector you were asking about):
Entity plane = new Entity();
plane.Roll(MathHelper.PiOver4);
Or pitch roll the airplane 90 degrees:
plane.Pitch(MathHelper.PiOver2);
And here's the code sample
public class Entity
{
Vector3 position = Vector3.Zero;
Matrix rotation = Matrix.Identity;
public void Yaw(float amount)
{
this.rotation *= Matrix.CreateFromAxisAngle(this.rotation.Up, amount);
}
public void YawAroundWorldUp(float amount)
{
this.rotation *= Matrix.CreateRotationY(amount);
}
public void Pitch(float amount)
{
this.rotation *= Matrix.CreateFromAxisAngle(this.rotation.Right, amount);
}
// This is the specific method you were asking for in the question title
public void Roll(float amount)
{
this.rotation *= Matrix.CreateFromAxisAngle(this.rotation.Forward, amount);
}
public void Strafe(float amount)
{
this.position += this.rotation.Right * amount;
}
public void GoForward(float amount)
{
this.position += this.rotation.Forward * amount;
}
public void Jump(float amount)
{
this.position += this.rotation.Up * amount;
}
public void Rise(float amount)
{
this.position += Vector3.Up * amount;
}
}
If you want a smooth movement you'll want to use these in very small increments, and use elapsed time in your calculations for the amount that you use.
CreateRotationXandCreateRotationYas well? However, there will be a bit more complicated mathematics when the plane is at different angles. But it'll be a combination of the 3 methods. - anothershrubery