Public Sub ShipPosUpDate()
'ShipPos.x = ShipPos.x + ShipSP * 0.01
ShipPos.y = ShipPos.y + ShipThru * 0.01
'ShipPos.z = ShipPos.z + ShipFP * 0.01
ShipPos.x = ShipPos.x + System.Math.Cos(ShipHead) * ShipFP * 0.01
ShipPos.z = ShipPos.z + System.Math.Sin(ShipHead) * ShipFP * 0.01
ShipM.RotateY(ShipHead * 0.01, True)
If ShipPos.y <> -34 And ShipPos.y > -34 Then
ShipPos.y = ShipPos.y - 1 * 0.01
ElseIf ShipPos.y = -34 Then
ShipPos.y = -34
End If
ShipM.SetPosition(ShipPos.x, ShipPos.y, ShipPos.z)
End Sub
Sorry to be flagrant here, but this code is not right. The correct code should be:
ShipPos = ShipPos + (Speed*0.01)*ShipM.GetDirection()
This will always move your mesh in the ship's direction. This is actually what the MoveRelative function does. But the MoveRelative function will cause a blow up (mesh disapears or acts completly wild) if your mesh's direction is (0,0,0). It will also blow up if any of your scale components are 0, that is (scale.x = 0 or scale.y = 0 or scale.z = 0). The above code will simply will not move if any of that is true.
...and it seems alot of ppl seem to think alot of things require trignometric functions. It this case it could, but it does not have to. And if you do use them, you have to consider how to use them. I may have to post a new thread about it if it becomes an epidemic.