Help rotating poses, please
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-04-2008 09:56
I'm trying to make a way to adjust all the poses in an MLP/MLPV2 positions file, for when you change the orientation of the MLP prim. For example, I have an MLPV2 sofa, works great -- only I want to change the cushion prim (contaning the scripts and anims) from an ellipse to a scuplty. As it turns out, for the texture not to have a seam on the top, I have to flip it over -- putting all my poses upside down under the cushion.
The positions are stored as an (offset, euler) pair for each poseball for each pose, relative to the containing prim.
I know how to adjust the offset. I need just a bit of help adjusting the euler rotation for the ball. I convert it to a quaternion, and I have the rotation I want (relative to the cushion's axes) as a quaternion.
I know how to rotate the ball relative to global axes, or the ball's axes, but not relative to the cushion's axes. Of course, I can get the cushion's rotation using llGetRot().
Rotations make my poor little head hurt. I should do them more, and I'd get used to them!
Thanks for any help!
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-05-2008 08:17
bump
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-05-2008 10:23
You mean these objects are not linked?
If so, the relative pos and rot of Object 2 against Object 1 (i.e. the offset and orientation of Object 2 with respect to the reference frame of Object 1) would be...
Where P2 => llGetPos() of target, P1 => llGetPos() of "root", R2 => llGetRot() of target, and R1 = llGetRot() of "root"...
relative position -> (P2 - P1) / R1 relative rotation -> R2 / R1
_____________________
http://slurl.com/secondlife/Together
|
|
Max Pitre
Registered User
Join date: 19 Jul 2006
Posts: 370
|
09-05-2008 10:39
I had the same issue so I put the scripts and poses into a regular square prim and linked it so the items would work on touch. It did cost an extra prim but made life so much easier. Or you can use an existing regular prim within your build and link that so it's the mother prim.
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-05-2008 10:40
The objects are not linked. The target is rezzed by the rezzer.
The code you post omits a key variable: the amount I want to rotate the object by.
The code already does what you post, to rez the object in its original orientation. But I want to rez it with more rotation (that's the missing variable I mentioned). So, would that be:
R0 = amount to rotate by, relative to rezzer's origin
P1 = rezzer's position (global) R1 = rezzer's orientation (global)
P2 = target's original position (relative to rezzer) R2 = target's original orientation (relative to rezzer)
P3 = target's new position (relative to rezzer) R3 = target's new orientation (relative to rezzer)
What's the equation for R3? It's neither of the below:
R3 = R2 * R0 # rotates relative to the target's axes R3 = R0 * R2 # rotates relative to the global axes
I need to rotate it relative to the rezzer's axes.
Thanks!
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-05-2008 15:09
From: Lear Cale I need to rotate it relative to the rezzer's axes. R3 = R0 * R1 * R2
_____________________
http://slurl.com/secondlife/Together
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-06-2008 06:32
Wow, that simple -- Thanks Escort. I think I'm beginning to see the light. 
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-06-2008 08:27
Darn, nope, not that simple. 
|
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
09-06-2008 12:36
I"m not sure I can visualize your problem entirely - is the "wrong" bit just the rotation or is it also the position..?
If just the rotation is "wrong" then the alternative may just be... R3 = R0 * R2 * R1
I'll contact you inworld
regs /esc
_____________________
http://slurl.com/secondlife/Together
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-06-2008 12:57
Position is right, just rotation is wrong. I'm going to try all the permutations and maybe I'll hit on the right one. I appreciate your help!
|
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
09-07-2008 06:20
I tried all 6 permutations, multiplying, and no luck. Most likely, there's an underlying bug: the values I think I have aren't what I think they are, or something like that. Or, we need to subtract rather than add one of the rotations.
The part I don't understand is the difference between the following two:
R1 * R2
vs.
R2 * R1
The wiki simply explains that they handle two particular cases, but that doesn't really give me a sense of the underlying theory -- what these two actually do.
Is quaternion multiplication associative? That is, are the following two equal?
(R1 * R2) * R3 R1 * (R2 * R3)
I'll have to look for you ingame and shout, to show you the code and the object in action. Without the big picture I can imagine it's hard to see why I'm trying to do this.
|