Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

The Zen of Rotation?

Cutter Rees
Registered User
Join date: 13 Oct 2006
Posts: 2
11-27-2006 09:20
I will modestly state I'm not a stupid person. I even understand trig. I think I grok the basics of dealing with rotations. But there's one thing I have yet to see a simple solution for.

I have an linked object X. The root rotation in Euler form is <0,0,0> If I want to make it swing back and forth on the Y axis, I convert <0,delta,0> to quant form and multiply it by llGetRot(), then do llSetRot.

Works great as long as nobody rotates the object. But if I want it to continue to swing along the same axis, relative to the unrotated object, how do I get the rotation to apply (I know it becomes a compound rotation of X and Y until I've rotated the linked object through 90 degrees, at which point it becomes a rotation solely in the global X axis.

As a visual aid, think of a grandfather clock with a pendulum. I need to be able to generate the swing of the pendulum regardless of the rotate of the object.

I'm sure it's a simple matrix operation, I just don't know what it is.

Cutter
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
11-27-2006 09:41
From: Cutter Rees
As a visual aid, think of a grandfather clock with a pendulum. I need to be able to generate the swing of the pendulum regardless of the rotate of the object.

I'm sure it's a simple matrix operation, I just don't know what it is.

swing * base_object_rotation

(works on the same principle the swing = delta * current_swing you use to determine final position of the item earlier in your example does)
Nynthan Folsom
Registered User
Join date: 29 Aug 2006
Posts: 70
12-01-2006 21:18
if your object is a child prim, don't you have to use llGetLocalRot to get the rotation relative to the root and llSetLocalRot to set it?