PDA

View Full Version : Local Axis Orientation Position & Rotation



ColacX
12-03-2009, 02:08 PM
Anyone know of a good way to calculate px,py,pz if given a rotationMatrix?

i tried
void BaseModel::moveLocalX(float v){
this->px += this->rotationMatrix[0]*v;
this->py += this->rotationMatrix[4]*v;
this->pz += this->rotationMatrix[8]*v;
}

but this only works for the camera not the world-objects
where am i thinking wrong?

ah think ive figured it out
void CoordinateSystem::moveLocalX(float v){
this->px += (this->rotationMatrix[0]+this->rotationMatrix[4]*this->rotationMatrix[8])*v;
this->py += (this->rotationMatrix[1]+this->rotationMatrix[5]*this->rotationMatrix[9])*v;
this->pz += (this->rotationMatrix[2]+this->rotationMatrix[6]*this->rotationMatrix[10])*v;
}
this seems to work. my right hand hurts lol, long night.