These forums are CLOSED. Please visit the new forums HERE
A real pain in the axis... |
|
|
Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
01-08-2006 05:37
I'm working on an object that needs to be able to rotate to point at a given location, but maintain a specific orientation with respect to the rest of the sim. Essentially I'm trying to orient on a provided roatation while ensuring that relative up/down for the object are correct with respect to the horizontal plane, and that the object's left/right axis is always perpendicular to global up/down. I'm convinced it's a simple matter of extrapolating and recombining euler rotations, but I'm entirely unsure how to go about it.
_____________________
Needlessly complicating LSL since 2005.
|
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
01-08-2006 05:47
You are best off keeping to quaternions. If they don't drive you insane, that is.
Quaternions are the things that scare all manner of mice and men. They are the things that go bump in the night. They are the reason your math teacher gave you an F. They are all that you have come to fear, and more. Quaternions are your worst nightmare. I required institutionalization last I tried to understand them, so I cannot offer further help per doctor's orders. ![]() |
|
Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
01-08-2006 05:55
I'm using quats now. They're not doing what I need them to. Rotating between two positions using quaternions causes the object to rotate around all three local axes. What I *want* it to do is rotate around two specific axes. I first want it to rotate around global up/down so that it's pointed in the compass direction of its target (local forward is at zero elevation with respect to horizontal, pointed at the target), then rotate around local left/right so that it points directly at the target while still maintaining relative up/down in the right quadrants.
_____________________
Needlessly complicating LSL since 2005.
|
|
Nepenthes Ixchel
Broadly Offended.
Join date: 6 Dec 2005
Posts: 696
|
01-08-2006 06:24
I made a teddy bear on a cloud that follows me, and faces towards me but always remains level (the generic pet script I had made him stare at my crotch). I used llLookAt() with something like:
llLookAt(<target.x, target.y, llGetPos().z>...) |
|
Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
01-08-2006 06:34
Noooooot quite what I need, but thanks. I want full range of motion but not full range of rotation, if that makes any sense. The method you describe essentially clamps rotation to a single plane, making it useful for orienting on the compass position, but not the elevation. I will try using a pair of llLookAt()s to normalize it, but I get the feeling it won't work for a moving target.
_____________________
Needlessly complicating LSL since 2005.
|
|
Introvert Petunia
over 2 billion posts
Join date: 11 Sep 2004
Posts: 2,065
|
01-08-2006 06:36
I'm not completely understanding what you are shooting for but think the examples under combining rotations should get you closer.
|
|
Alfred Lardner
Mad Scripter.
Join date: 28 Dec 2005
Posts: 28
|
01-08-2006 06:45
I think I may accidentally have found a solution. It requires redesigning the object so as not to have to worry about roatational anomalies, but I think I'll manage.
![]() _____________________
Needlessly complicating LSL since 2005.
|
|
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
|
01-08-2006 13:33
how about llSetStatus(STATUS_ROTATE_X,FALSE)?
(or the Y and Z variant) _____________________
![]() |
|
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
|
02-14-2006 02:28
I think I may accidentally have found a solution. It requires redesigning the object so as not to have to worry about roatational anomalies, but I think I'll manage. ![]() Redesign how? I'm trying to get a raft to stay rotated horizontally (x/z axes) but allow any vertical/y-axis rotation. |
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
02-14-2006 02:39
Alfred - just to make sure I'm understanding properly - you want to allow pitch and yaw, but no roll - like the turret of a tank?
If not, can you give us a real-world example of the sort of motion you're looking for? And Eep - you want pitch only? |
|
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
|
02-14-2006 02:47
No, Ben, *I* want like a tank turret, but more like a floating raft. I have most everything else but free vertical rotation (around up/y/blue axis)...
|
|
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
|
02-14-2006 05:47
Pitch and Yaw, no Roll:
CODE
Yaw, noPitch nor Roll: CODE
![]() _____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
|
|
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
|
02-14-2006 22:08
Jes, I don't think you understand what I want because that's the 3rd script you've posted that does the same thing they ALL do: lock rotation on ALL 3 AXES. I want FREE ROTATION ON the vertical axis but LOCKED rotation on the other axes (horizontal and depth).
|
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
02-15-2006 00:38
Eep, I already have a script that does what you're looking for, but I spent Valentine's day in RL
I'll be in tonight (+-noon SL time) to find it.I don't have one that does Alfred's requirements yet, but I should be able to put one together. |
|
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
|
02-15-2006 13:21
Yaw Only
CODE vector Offset = llDetectedPos(0) - llGetPos();Yaw and Pitch CODE vector Offset = llDetectedPos(0) - llGetPos(); |
|
Eep Quirk
Absolutely Relative
Join date: 15 Dec 2004
Posts: 1,211
|
02-15-2006 17:05
Thanks, Ben, but neither of these work either; they just allow all-axis rotation and don't use llRotLookAt, which is what I'm trying to do. When I switch llSetRot to llRotLookAt, the scripts act the same as all the others: restricted all-axis rotation.
|