3D space movement

Started by
2 comments, last by Canazza 20 years, 11 months ago
Okay, I have a basic engine set up that allows movement in 2D space, however, i''m having trouble working out how to extend it into 3D. I want to have a movement similar to the game Elite, with a Truespeed (the resultant of the three X,Y and Z speed) a rotation and a pitch. at the moment i''m stumped, I think i''m getting close but then I start confusing myself. can anyone help? I''m a big scary monster and i''m comming to eat you - raaargh
Advertisement
bump


[edited by - oliii on May 26, 2003 11:45:16 AM]

Everything is better with Metal.

an example of a structure


  struct CCoolShip{    Vector3 Pos, Vel, Acc;    Matrix3 Orient;    CCoolShip()    : Pos(Vector3::Zero())    , Vel(Vector3::Zero())    , Acc(Vector3::Zero())    , Orient(Matrix3::Identity())    {}    void Update(float Accel, float Roll, float Pitch, float dt)    {         Vector3 Dir  = Orient.GetDirection(Vector3::eForward);        Orient.RotateAroundAxis(Dir, (Roll * dt));        Vector3 Right= Orient.GetDirection(Vector3::eRight);        Orient.RotateAroundAxis(Right, (Pitch * dt));        Acc += Dir * Accel;                Orient *= (RotRoll * RotPitch);        Pos += Vel * dt + Acc * dt*dt;        Vel += Acc * dt;        Acc = Vector3::Zero();    }};  




If you want to code a 3D game, you''d better write your own matrix and vector libraries, with operator overloading and all that. Or use on from the net. There are loads.

In short Orient.GetDirection() return either one the rows or column (depending if your matrices are column or row major). All the other operations are standard matrix operations, that you should really know about. Also, it is better to use quaternions than matrices for rotations. Quaternions may sound scary at first, but it''s the safest way to achieve rotations in 3D.

Everything is better with Metal.

Do you know any reputable sites where I can get matrix definitions?

I already have a vector definition.

I''m a big scary monster and i''m comming to eat you - raaargh

This topic is closed to new replies.

Advertisement