Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help with quats!

Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
04-08-2006 01:12
I want to provide a rotation around a specific single axis to look at (or near rather) a (potentially) moving point - think tracking the sun's rotation approximately by rotating around the world's Z axis for example.

llRotBetween would take a unit axis and the relevant rotation and rotate around all the axes (in general anyway, some might by chance give a single axis).

Any good tips or pointers? Or even a code snippet for a general axis solution?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
04-08-2006 01:45
Well. You could cheat by limiting two of the axes (as with llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);) and using llLookAt.

Failing that, there is a way to do it the long way... but it's messy. I'll dig it up if needed though.
_____________________
---
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
04-08-2006 01:52
I usually just set the Z of what I'm trying to look at to be the same as the Z of the looker.

e.g.
CODE

point_at_z(vector target)
{
vector pos = llGetPos();
target.z = pos.z;
llSetRot(llRotBetween(<1.0, 0.0, 0.0>, llVecNorm(target - pos)));
}
Tip Baker
Registered User
Join date: 12 Nov 2005
Posts: 100
04-08-2006 04:00
I've found the snippet of code here very useful for pointing objects at things