Hi i am making a space game and i am trying to make my model move. i want my model to tilt a bit and then turn. However when i do that my model begins to point upwards when i press the button and i am thinking that it is because my model is rolled a bit. i have tried subtracting the amount of yaw from pitch, but that did nothing. here is my code:
if (keyboardState.IsKeyDown(Keys.A))
{
if ( tempRoll > -MathHelper.ToRadians(45 /2))
{
rollAngle -= MathHelper.ToRadians(turningSpeed);
}
yawAngle -= tempRoll / 10;
//direction.X -= rollAngle;
}
if (keyboardState.IsKeyDown(Keys.D))
{
if (tempRoll < MathHelper.ToRadians(45 / 2))
{
rollAngle += MathHelper.ToRadians(turningSpeed);
}
yawAngle += -tempRoll / 10;
pitchAngle += pitchAngle - yawAngle;
//direction.X += -rollAngle;
}
tempRoll += rollAngle;
tempYaw += yawAngle;
tempYaw = MathHelper.Clamp(tempYaw, 0, 0.01f);