10-22-2009 13:13
Hi, I have got a seat prim that sets the sit position and camera position as follows:

llSitTarget(<0.25, 0, 0.05>, ZERO_ROTATION);
llSetCameraEyeOffset(<-2, 0, 1> * ZERO_ROTATION); // 2 meters back and 1 meter up from sit point
llSetCameraAtOffset(<0, 0, 1> * ZERO_ROTATION); // 1 meter up above sit point

It works perfectly, when you sit the camera snaps to the correct position no matter how I rotate the prim.

However, I also want the user to be able to switch through three pre-determined views. I have predetermined views loaded from a notecard with region co-ords like this:

# camera pos, target pos
<240, 157, 25>,<255, 157, 23>
<243, 145, 38>,<249, 152, 38>
<243, 127, 40>,<255, 157, 23>

After the user sits down they can use PgUp/PgDn to toggle through these views... and it works. Fantastic, but it doesn't include the initial "over the shoulder" view for that specific seated avatar.

So, my question is: How would I determine the region co-ords given the CameraEye and CameraAt relative co-ords given above?

I'm pretty sure I could get the sit prim regional co-ordinates and modify them with the relative offsets, correct? Can anyone provide a code snippet to help me out here? It's so confusing.

Thanks!
- Watty