Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Parent Objects & llTargetOmega

Helen Quatro
Cephalopod Overlord
Join date: 6 Sep 2005
Posts: 24
12-21-2005 16:29
I've been using modified versions of Lex Neva's smooth rotation script for some time in various objects. It works beautifully except when the object I'm rotating is linked to a parent who's rotation is not (0,0,0).

What I have been doing is adding an extra sphere that I set the rotation to the aforementioned, but am wondering if there is a way around this.

I'd like to just be able to rotate the whole objects however I'd like without having to always make sure the parent is at the proper rotation.

Thanks for any help or advice.
_____________________
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
12-26-2005 16:21
Ah. llTargetOmega is fun because it runs on a global coordinate system as opposed to a local one. This can be quite frustrating exactly for the reason you describe.


The easiest way to counter that would be to use the implicit quaternion maths included in LSL. Here's a quickie that should factor in the parent's rotation:


CODE

...

// Vector times rotation equals vector in that rotation's "frame of reference"
vector parentRot = llGetRootRotation(); // Gets the rotation of the root prim
llTargetOmega(ROT_AXIS * parentRot,-ROT_ANGLE/ROT_TIME,1); // Simple, yes?

...

(Wiki page for llGetRootRotation)
_____________________
---
Helen Quatro
Cephalopod Overlord
Join date: 6 Sep 2005
Posts: 24
12-27-2005 12:02
Ahh, thank you! That should be a great help to my many projects. llGetRootRotation will certainly become my favourite function.
_____________________