But when I set the camera according to the position of the character model it seems like the model will start to rotate around the camera position even though it should have nothing to do with the camera matrix. No parent is set or anything like that.
Any ideas about this?
Code: Select all
irr::core::matrix4 modelMat;
irr::f32 moveSpeed = 100.0f;
modelMat = myModel->getAbsoluteTransformation();
irr::core::vector3df vecZ(modelMat.M[8] * moveSpeed, modelMat.M[9] * moveSpeed,
modelMat.M[10] * moveSpeed);
irr::core::vector3df vecY(modelMat.M[4] * moveSpeed, modelMat.M[5] * moveSpeed,
modelMat.M[6] * moveSpeed);
irr::core::vector3df modPos = myModel->getAbsolutePosition();
modPos.X = modPos.X + vecZ.X;
modPos.Y= modPos.Y + vecZ.Y;
modPos.Z = modPos.Z + vecZ.Z;
modPos.X = modPos.X + vecY.X;
modPos.Y= modPos.Y + vecY.Y;
modPos.Z = modPos.Z + vecY.Z;
aCam->setPosition(modPos);
//myModel->setPosition(myModel->getAbsolutePosition());
aCam->setTarget(myModel->getAbsolutePosition());