Hi guys,
I'm using OPenGL to make a small modelling program. I want to translate my objects relative to my camera. I can get my objects to translate towards & away from my camera. I get the vectors of my object position & camera position, minus them, then normalise the result. Translating to & from the camera is the same as translating up & down the cameras relative Z-axis.
But I am having trouble with translating my objects relative to my camera's x-axis. To find the camera's x-axis, I am using the code:
SceneVector3 cameraOrthogonalVector = cameraPositionVector.CrossProduct(cameraLookAtVector);
cameraOrthogonalVector.Normalise();
where
SceneVector3 SceneVector3::CrossProduct(const SceneVector3& vector) const
{
return SceneVector3( y*vector.z - z*vector.y,
z*vector.x - x*vector.z,
x*vector.y - y*vector.x );
}
But this is not giving the correct results. Say if my object is at position 0,0,0 & my camera is at 0,0,-20 my object won't translate at all.
Can some1 help me here?
Thanks for any help given!
Reject the basic asumption of civialisation especially the importance of material possessions