|
|
> Well. Was more wondering if there was some "sane" way to handle them
> without having the convert them at all. Basically, you do something
> like:
>
> a = llGetRot(me);
> b = llGetLookAt();
>
> then either do 'llSetRot(a*b);' or 'llSetRot(b);', depending on if you
> want to try to preserve "any" of the original orientation. The problem,
> of course, is simply that 'b' is not oriented to the same up/down or
> even top/bottom as 'a' in the first place. So, you either have to delete
> one of the angles, then apply, or convert to Euler, switch them around,
> then convert back to Quaternian, and *then* apply. The first method
> seems to be impractical, or impossible, take you pick, due to how the
> the stuff works. Its seriously annoying.
The 2nd method you propose seems feasible.
I would rotate the "forward" direction of your model (eg the axis vector
(1,0,0)) by the quaternion "a". Maybe your script language lets you do this
just with a *, if not you need to look up how to rotate a vector by a
quaternion - it's not hard or expensive.
Then with this vNew, you can work out the two rotation angles, limit them to
whatever ranges you see fit, then create a new quaternion from these angles.
Post a reply to this message
|
|