Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rotating a root object around its own coordinate system?

Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
03-01-2006 15:33
Does anyone know if it's possible to rotate the root prim of a linked object with relation to the object's own coordinate system instead of the global one? (Ie, so that a Z rotation on a disc will always cause it to spin like a wheel, no matter what angle the wheel is placed at in world?)
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
03-01-2006 15:42
Try something like this:
CODE

// In a timer event...
rotation oneRad = llEuler2Rot(<0, 0, 1>);
llSetLocalRot(oneRad * llGetLocalRot());

I *think* that might work.
Also, have you considered texture animation as an alternative? It will give the rotation a much more continuous feel - and its less laggy then repeated llSetRot calls too! :D
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
03-01-2006 15:43
The way I do this (and I'm sure there's a much more efficient way, but I can understand this, so I use it) is to:

* Use llRot2Up to get the vector that tells me where the Z axis is pointing right now
* Use llAxisAngle2Rot to figure out what the new rotation is, since I need to turn X radians around the axis I just calculated

Maybe I misunderstood you though, and that's not what you're asking.
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
03-01-2006 16:57
From: Ziggy Puff

Maybe I misunderstood you though, and that's not what you're asking.


It was and it worked :)

Thanks!!