Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Periodic X and Y rotation

Ghosty Kips
Elora's Llama
Join date: 2 May 2008
Posts: 2,386
08-18-2009 07:38
So, I'm making a flying saucer. :D Just to teach myself how to do stuff.

I presently have two scripts in the root of this thing. One is a simple llTargetOmega that spins the saucer on it's Z axis, and another that uses llSetBuoyancy to let the thing float up and down a bit. So far, so good.

Here's where I have the issue. When floating about, it will occasionally hit the floor, bounce a bit, and travel off in some horizontal direction. That's fine, but it will inevitably bump something and end up a bit sideways. I'd like it to right itself every few seconds in case this happens.

I tried the simple solution first:

CODE

default
{
state_entry()
{
llSetTimerEvent(3);
}

timer()
{
llSetRot( ZERO_ROTATION );
}
}


This does nothing at all. Afterwards, I started fooling with vectors, llEuler2Rot, and so forth. Nothing works.

All I want this thing to do is rotate the object on its X and Y axii to 0 every few seconds. Help?
_____________________
--
Why aren't you doing something more useful, like playing WoW?
Drifter Dreamscape
Registered User
Join date: 30 Mar 2008
Posts: 182
08-18-2009 08:16
Have you waded through the stuff on the wiki? Bound to be pointers in there:
http://www.lslwiki.net/lslwiki/wakka.php?wakka=TutorialVehicle
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
08-18-2009 08:17
Seems to be the root prim of a physical object (llSetBuoyancy, bouncing around), so you might want to try llRotLookAt() instead. Or something like:

llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);

Probably have to try it out in your application to decide which has the lesser effect on the "naturalness" of the motion.
_____________________
Archived for Your Protection
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
08-18-2009 10:00
Look at "The Vertical Attractor" section at:

It talks about what boats use to keep their "up-side up". I think this is the sort of behavior you are looking for. That way, you'd be able to control how much the saucer wobbles before righting itself.
Ghosty Kips
Elora's Llama
Join date: 2 May 2008
Posts: 2,386
08-18-2009 13:06
From: Qie Niangao
Seems to be the root prim of a physical object (llSetBuoyancy, bouncing around), so you might want to try llRotLookAt() instead. Or something like:

llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);

Probably have to try it out in your application to decide which has the lesser effect on the "naturalness" of the motion.


Stupid forums, wouldn't let me reply. >:( I can't post the code, not even inside php tags.

llRotLookAt() did the trick. I didn't look at this function yet, but the answer was right there in the wiki.


Thank for the suggestions. :)
_____________________
--
Why aren't you doing something more useful, like playing WoW?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-18-2009 13:29
From: Ghosty Kips
Stupid forums, wouldn't let me reply. >:( I can't post the code, not even inside php tags.

llRotLookAt() did the trick. I didn't look at this function yet, but the answer was right there in the wiki.


Thank for the suggestions. :)

Look at every vector and rotation in your script and add a space after the opening bracket:
< 0,0,0>, < 0,0,0,1>
works! Take the space out and you can not post.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
08-18-2009 13:52
From: Ghosty Kips
This does nothing at all. Afterwards, I started fooling with vectors, llEuler2Rot, and so forth. Nothing works.

I'm pretty sure that llSetRot is ignored on objects that are physical..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Ghosty Kips
Elora's Llama
Join date: 2 May 2008
Posts: 2,386
08-19-2009 07:02
From: Jesse Barnett
Look at every vector and rotation in your script and add a space after the opening bracket:
< 0,0,0>, < 0,0,0,1>
works! Take the space out and you can not post.


Sheesh. :)

CODE

default
{
state_entry()
{
llSetTimerEvent(3);
}

timer()
{
//llSetRot( ZERO_ROTATION );
vector eul = < 0,0,FALSE> ; //we dont care about the z axis anyway
eul *= DEG_TO_RAD; //convert to radians
rotation quat = llEuler2Rot(eul); //convert to quaternion

llRotLookAt( < quat.x, quat.y, FALSE, 1>, 0.2, 1 );
}
}
_____________________
--
Why aren't you doing something more useful, like playing WoW?
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-19-2009 09:38
From: Ghosty Kips
Sheesh. :)

Glad to see you have it figured out with my incomplete instructions!

I forgot to add that you need to do all of that , while keeping in mind the SQL keywords AND while standing on one foot only with a North/South orientation of the foot that is in the air.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-19-2009 10:12
From: Ghosty Kips

vector eul = < 0,0,FALSE> ; //we dont care about the z axis anyway

llRotLookAt( < quat.x, quat.y, FALSE, 1>, 0.2, 1 );
What is the purpose of using "FALSE" in these locations? It is not treated by the compiler as anything different from the constant zero.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore