Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# a moving function based on 3 (euler) angles

Posted on 2004-08-28
Medium Priority
217 Views
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;
}
0
Question by:DaFou
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 84

Accepted Solution

ozo earned 2000 total points
ID: 11949107
shipPos.X += speed * X;
shipPos.Y += speed * Y;
shipPos.Z += speed * Z;
0

LVL 2

Author Comment

ID: 11961690
Hehe somehow it works. TYVM.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
###### Suggested Courses
Course of the Month7 days, 8 hours left to enroll