# a moving function based on 3 (euler) angles

I'm still writing a program with a spaceship that moves freely through empty space.

The following function is supposed to handle the movements. The 3 lines of code seem to move the ship in
the right direction, but I want to know how to combine them so my ship can move right in all 3 (or at least 2)
directions. Hoping this function works in the first place.

// there is a ship that has a ('input')direction and a ('output')position
// the direction is noted by 3 angles ranging from 0=< angle <360, position by a vector shipPos.X, Y, Z
private void Move(float speed)
{
// direction 1, let it yaw doesn't combine with 3 lines below direction 2
shipPos.Y += 0.0f;
// direction 2, let it pitch doesn't combine with above 3 lines
shipPos.X += 0.0f;
// maybe let it roll also
//shipPos.Y += 0.0f;
}
LVL 2
###### Who is Participating?

Commented:
shipPos.X += speed * X;
shipPos.Y += speed * Y;
shipPos.Z += speed * Z;
0

Author Commented:
Hehe somehow it works. TYVM.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.