07-16-2008 06:47
heyas;

okay, i have a large eyeball that follows the avatar's camera facing. due to technical details i won't get into, the eyeball is attached to a part of the avatar that is turned upside down.

i finally got the thing to stop turning left when i swing the camea right by inverting the z on the euler version of the rot. but how to get it to go up and down properly is beyond me. is there actually a simple way to invert a quaternion? i tried multiplying all the euler inputs by 180 (*deg to rad); but that was no help.



the script thus far, if that matters:

//----------------------------------------------
//-- Eyeball Roller
//-- by bloodsong termagant
//----------------------------------------------
// Read camera facing
// its about... 45 degrees off on z?
//
//-----------------------------------------------


default
{


state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA);
llSetTimerEvent(3.7);
}


timer()
{
rotation rCam = llGetCameraRot();
//--lets try to flip it for the zoghund upside down pec
vector vCam = llRot2Euler(rCam);

vCam.z = -vCam.z;

rCam = llEuler2Rot(vCam);

llSetLocalRot(rCam/llGetRootRotation());

}


}
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705