Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Quick rotation question for y'all.

Lance LeFay
is a Thug
Join date: 1 May 2003
Posts: 1,488
08-24-2007 08:43
Hey everyone, I have a question question for you...

Let's say I want to "horizontalize" a rotation- how would I get that? That is, if I have a rotation, and I want to keep pointing in the same direction on the XY plane, and make the rotational vector parallel to the XY plane, how would I go about doing that?

Thanks guys.
_____________________
"Hoochie Hair is high on my list" - Andrew Linden
"Adorable is 'they pay me to say you are cute'" -Barnesworth Anubis
Lance LeFay
is a Thug
Join date: 1 May 2003
Posts: 1,488
08-24-2007 08:55
If worst comes to worst I guess I can bisect this by changing the Z axis of a <0,0,0> rotation and minimizing the angle between the... angles.
_____________________
"Hoochie Hair is high on my list" - Andrew Linden
"Adorable is 'they pay me to say you are cute'" -Barnesworth Anubis
Shadow Subagja
Registered User
Join date: 29 Apr 2007
Posts: 354
08-24-2007 11:31
there are functions to take a rotation and turn it into a vector pointing in the direction of rotation (llRot2Euler I think). You could covert to euler, set vector.z to zero, then convert back to rotation using llEuler2Rot. You may be able to manipulate the rotation directly if you understand quaternions, I don't :P.

I _think_ that is what you are getting at?
Naryu Yue
Interrupted?
Join date: 23 Jul 2007
Posts: 15
08-24-2007 11:36
you can align one of the axis of an object with a direction of choice using llRotLookAt()

this codesnippet might is a lot usefull for that, look:]

rotation getRotToPointAxisAt(vector axis, vector target) {
return llGetRot() * llRotBetween(llVecNorm(axis * llGetRot()), llVecNorm(target - llGetPos()));
}

llRotLookAt(getRotToPointAxisAt(AXIS_FWD, target), strength, damping);
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
to be honest...
08-24-2007 12:05
I am not sure what you are getting at. Perhaps give an example in specific terms, such as

...a bird is level pointing in some direction. What rotation do I need to get it to point 25 degrees to the left while still being level?