Help me learn rotations, quaternions, etc
|
|
Hamncheese Omlet
what's for breakfast?
Join date: 2 Apr 2006
Posts: 79
|
06-09-2006 15:10
So I've played around with rotating objects around its own axis; or have cut a prim so that the perceived leading edge is the axis; read 2+ years of posts in this forum; studied the wiki till my head is spinning around on its own axis  In a previous life I studied 3D drafting in AutoCad, my rl job is a software architect. Given all that I still don't understand enough to solve what I think is basic. I want to be able to rotate a prim around an arbitrary axis other than it's own. I'm not asking how to take an invisiprim and link the object to that and rotate the invisiprim. I already know how to do that and I already know how to cut the prim in half and rotate, etc. Neither of these options are close to what I'm looking for. I'm not looking for someone that got a script from someone else. I've got the Wiki for that  . I'm looking for someone to teach me 1-on-1 in 2-1 hr sessions (or whatever it takes) how to use quaternions that leads to the solution and I am willing to pay whatever it takes to learn this. Please IM me in game (usually around 9:30p-1:00a EST) if you can fill this role. Be prepared to give me a quote in L$ or US$, and and a small demo of your capabilities with rotations and when you are generally available. I'll consider any proposals and choose one such person by Monday or Tuesday night. Thanks, Ham
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
06-09-2006 15:49
If you're trying to get a prim to smoothly rotate, then the llTargetOmega function will do it, and you put in the axis of rotation as one of the inputs of the function. If you want to take a prim to a new rotation (using llSetRot say), and want to have the new rotation be the result of rotating around some arbitrary axis by some angle, use llAxisAngle2Rot.
I'm not sure what else there is you would need to know...?
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
06-10-2006 01:39
There's some local rotation and movement scripts available from Phase 5 airstrip in SL, in the office, to the right. Those will probably achieve what you want, which I think is a rotation about a point other than the centre of the primitive?
|
|
Hamncheese Omlet
what's for breakfast?
Join date: 2 Apr 2006
Posts: 79
|
Thanks for the replys
06-10-2006 20:00
Angela,
I did look up the Phase 5 airfield and picked up the rotation scripts that you were talking about. Still studying them to see how it applies to what I want. Oh by the way, I picked up a very nice helicopter while I was there. Sweet!!!
Seifert,
Thanks for replying. I suspected that I would use llAxisAngle2Rot, but I don't know what to do with the result. I tried plugging the result into llSetPos and my prim rotated 3 different angles. Am I missing a conversion? An example rotation here
XY XY XY----------------------O XY XY
Ok...this is the best way I can think to do this. Consider that the "O" in the middle is the rotation point and the XY's make up the box prim where Y is the face.
When I rotate, it needs to be like this (ignore the dashes, I needed them to make this turn out right).
XY-------------------------------------------YX XY-------------------------------------------YX XY----------------------O-------------------YX XY-------------------------------------------YX XY-------------------------------------------YX
Red is the new position if this formatting works correctly. The face of the prim needs to face the "O"
___________________ Added for clarity: This works great when the angle is 180 degress. Even though it is lame, I can move to desired location and flip 180 around the z axis to get the face of the prim the correct orientation. But what if I want to rotate 30degress from the original location? How do I accomplish that? ___________________
Am I making this too hard?
Thanks,
Ham
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
06-11-2006 00:47
Ah, sounds like Angela spotted what you were after. You want to rotate around an axis that doesn't go through the center of the prim, and the way to do this involves changing the position as well as the rotation. http://secondlife.com/badgeo/wakka.php?wakka=rotation talks a little about this in the paragraph starting "Note: An object can be rotated around an arbitrary point...".
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Angela Salome
Registered User
Join date: 6 Oct 2005
Posts: 224
|
06-11-2006 02:51
From: Seifert Surface Ah, sounds like Angela spotted what you were after. You want to rotate around an axis that doesn't go through the center of the prim, and the way to do this involves changing the position as well as the rotation. http://secondlife.com/badgeo/wakka.php?wakka=rotation talks a little about this in the paragraph starting "Note: An object can be rotated around an arbitrary point...". The scripts for local rotation and movement will help greatly as they give practical working examples.
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
06-11-2006 09:45
I think this function in the scripting library does what you want, or close to it. Al DaSilva's OffsetRot function offsetRot(vector rotPoint, rotation rotAngle) { rotation new_rot = llGetRot() * rotAngle; llSetRot(new_rot); vector currentPos = llGetPos(); vector newPos = rotPoint + ((currentPos - rotPoint) * rotAngle); llSetPos(newPos); }
The llSetPos(newPos) at the end should be put in a loop with a test for accuracy due to the ten meter limit, or one might use the llWarpPos approach.
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Hamncheese Omlet
what's for breakfast?
Join date: 2 Apr 2006
Posts: 79
|
thanks for the input
06-11-2006 11:10
These replies should help. I'll play around with this until I get the "aha" moment. If you get the chance, come visit my workshop to see the projects I'm working on. http://slurl.com/secondlife/Chokki/6/210/53/?msg=Ham%27s%20WorkshopHam
|
|
Joannah Cramer
Registered User
Join date: 12 Apr 2006
Posts: 1,539
|
06-11-2006 12:54
From: Hamncheese Omlet So I've played around with rotating objects around its own axis; or have cut a prim so that the perceived leading edge is the axis; read 2+ years of posts in this forum; studied the wiki till my head is spinning around on its own axis  In a previous life I studied 3D drafting in AutoCad, my rl job is a software architect. Given all that I still don't understand enough to solve what I think is basic. I want to be able to rotate a prim around an arbitrary axis other than it's own. I'm not asking how to take an invisiprim and link the object to that and rotate the invisiprim. Would suggest to run a google search for some primers on openGL and axis-angle/quaternion rotations.. the most basic ones with pictures can make it much easier to understand how putting offsets and rotations goes together, and then you can utilize quite a bit of that in LSL. Martin Baker's page is possibly a good place to start ^^;;
|
|
Hamncheese Omlet
what's for breakfast?
Join date: 2 Apr 2006
Posts: 79
|
Update on my learning progress
06-11-2006 19:41
nand Nerd dropped by my workshop earlier today and we worked out a example script using trig to get what I wanted. Although he didn't ask for payment for his time, I was able to give a token amount of L$ for him taking the time in game to come see me and work out a solution.
Thank you, nand for dropping by and for also showing me some of things you are building.
All, if you get a chance to look at nand's picks, visit his Flexi Fun place. Some awesome work he has done with flexiprims.
Suzeanne, I haven't had time to play with your suggestion, but I will do so sometime this week.
Joannah, Ahh thanks for the link to the Martin page. I was able to do a quick read and see that it was exactly the kind of technical information I'm looking for.
Thanks again everyone.
Ham
|
|
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
|
06-12-2006 04:01
You're most welcome Hamncheese and thank-you for the kind words. =D
|