Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Creating tail movement

Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
10-25-2005 15:22
Okay, I noted this in the thread about a rocking chair, but it's kind of a different problem so I'm posting seperately.

Basically I've created a tail for my character, and when clicked it can moved into different positions so it isn't sticking into the ground or such (I may experiment with collisions to see if that can do it automatically but that's besides the point).

Anyway, what I'm hoping to do is have the tail swish about when idle or moving, but I'm having difficult to find a way to do this reasonably smoothly.

Now I latched on llTargetOmega as the best option, since it allows smooth rotation with no server lag. However, it seems to be impossible to have it simply rotate an item in one direction, then reverse, feeding it negative values flips the tail over to the other side of my av and continues it moving it away from where I want it to go. The only way to get it to reverse seems to be to reset it to the middle position (feed it an empty vector as the axis for it to rotate upon), however this still doesn't appear to work as the tail can end up swishing further and further this way, to the point it's swinging around my character's front which is just wrong.

I know some people out there must have made a tail using this by now (I saw an animated gif somewhere for one in the preview environment), so I'm wondering how these solutions were made, or if there are any general tips and tricks for doing such movement.
I'd like to avoid llSetRot where possible to avoid jerky movements.
Ralek Queso
Registered User
Join date: 3 Feb 2005
Posts: 32
A couple of suggestions
10-25-2005 16:56
Try messing around with these:

llLookAt
llRotLookAt
_____________________
Llewelyn Mistral
Registered User
Join date: 5 Oct 2005
Posts: 49
10-27-2005 13:00
When I tried doing anything with llRotLookAt, it was moving ME instead of the tail.
Myrilla Vixen
Definitely Bloo
Join date: 11 Jun 2005
Posts: 143
10-29-2005 12:03
I'm looking for a good way to do that same thing. I am experimenting with llSetRot in unison with llTargetOmega, but I still think I must be missing something that would make this truly look good.

any advice?
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-29-2005 12:31
From: Llewelyn Mistral
When I tried doing anything with llRotLookAt, it was moving ME instead of the tail.

Does it mean we now have a method for turning an AV in a given direction ? It wasn't working in v1.6 :o
_____________________
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.
Beclamide Neurocam
3.14159265
Join date: 8 Oct 2005
Posts: 70
10-29-2005 16:07
Have you tried using joints and just moving the last segment around?
Haravikk Mistral
Registered User
Join date: 8 Oct 2005
Posts: 2,482
10-29-2005 16:11
Aren't joints pure evil? If it were possible to use them without imploding the universe, how would I go about it? I haven't touched joints at all due to the various warnings people seem to give in regards to them... :D
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
10-29-2005 19:35
Have you tryed llTargetOmega(direction, speed, 1.0) and toggling to llTargetOmega(-direction, speed, 1.0) in a timer event?
==Chris
_____________________
October 3rd is the Day Against DRM (Digital Restrictions Management), learn more at http://www.defectivebydesign.org/what_is_drm
Myrilla Vixen
Definitely Bloo
Join date: 11 Jun 2005
Posts: 143
10-30-2005 07:54
From: Christopher Omega
Have you tryed llTargetOmega(direction, speed, 1.0) and toggling to llTargetOmega(-direction, speed, 1.0) in a timer event?
==Chris


From: Haravikk Mistral
Now I latched on llTargetOmega as the best option, since it allows smooth rotation with no server lag. However, it seems to be impossible to have it simply rotate an item in one direction, then reverse, feeding it negative values flips the tail over to the other side of my av and continues it moving it away from where I want it to go. The only way to get it to reverse seems to be to reset it to the middle position (feed it an empty vector as the axis for it to rotate upon), however this still doesn't appear to work as the tail can end up swishing further and further this way, to the point it's swinging around my character's front which is just wrong.


Got the same results myself, even using llSetRot and a complex pattern of llSleeps to counteract the flipping the end result is a peice of crap.

Edit: I think it's mostly cause of llTargetOmega being client side, so when you change direction it resets to it's rotation defaults(since the server has no friggin clue where it's rotating from, because it has no way of getting the new rotation back from the client).. so I /think/ llTargetomega is saying "start spinning this way, starting from your last server-defined rotation" and we are wanting it to just change direction for us.. if that makes sense. -.-;\

And even if there is a work around, the first time you get even a hint of video lag the whole she-bang is gonna go offkilter, and lose the smooth pretty effect anyway.

From: Haravikk Mistral
I know some people out there must have made a tail using this by now (I saw an animated gif somewhere for one in the preview environment), so I'm wondering how these solutions were made, or if there are any general tips and tricks for doing such movement.
I'd like to avoid llSetRot where possible to avoid jerky movements.


In the gif it's just a nicely shaped tail spinning at a continuous speed, it's not swishing, and it would probably look less well done if he was standing still.(no offense to the maker of said tail, honest)..

Edit: I guess you could make a little AO for it, and I bet there are ways to make it even more decent, but I think we have to consider the 'swishing tail' a bust, unless you use a mess of jerky llSetRots.. which I may do today.
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
11-01-2005 11:06
From: Haravikk Mistral
Aren't joints pure evil? If it were possible to use them without imploding the universe, how would I go about it? I haven't touched joints at all due to the various warnings people seem to give in regards to them... :D


Every time I've touched them I forget what I'm talking about, watch cartoons and eat all of the junk food in the panty. Wait, are we talking about the same thing?
Stickman Ingmann
Regislered User
Join date: 15 Jul 2005
Posts: 12
11-01-2005 21:00
From: Haravikk Mistral
Anyway, what I'm hoping to do is have the tail swish about when idle or moving, but I'm having difficult to find a way to do this reasonably smoothly.


I've done something like this myself, and I have a "working script". The method I used was to llTargetOmega the tail, then llSetPos and kill the Omega. The info you'll need is thus:


Get your starting and ending "swish" positions, in radians (keep the degrees around, they'll be useful). I could explain degrees and radians, but this page does it just fine: http://secondlife.com/badgeo/wakka.php?wakka=radian

Let's say, for the sake of example, you want to go from 45 degrees to -45 (315) degrees. In radians, that's PI / 4 to 7 * PI / 4. In LSL that's the aforementioned, or even 45 * DEG_TO_RAD to 315 * DEG_TO_RAD.

Next value we need to know is the time you want it to take to travel that arc. That's a 90-degree arc, or one forth of a loop. To make things easy, let's say one second. (That means it would take four seconds to make an entire circle)

Here's a timeout while I make sure llTargetOmega is understood.

------------
llTargetOmega(<0,0,1>, PI, 1.0);

The first part (<0,0,1>;) is the direction. I recommend keeping it at value "1" for whatever direction you're rotating the tail in and only changing "PI" to change the speed.

The second part (PI) is the speed. PI is pi, or half the arc. PI_BY_TWO (I think that's the value for two pi) is a full loop in one second. PI / 10 would be a 10th of a loop in one second. (<0,0,1/10> or <0,0,0.1> without changing PI would give the same result, but is more confusing in this scenario)

The last part (1.0) is used for physical objects, which your tail is not. Leave it non-zero or I hear llTargetOmega won't work.
-------------

So to travel a PI / 4 arc in one second we will need llTargetOmega to use PI / 4 as the speed. (If we wanted it to take half a second, we would use PI / 2, etc)

After it travels that arc, we need it to stop, and then we need to set that position as the tail's new position -- because llTargetOmega is clientside, the tail never really moved. This can be done by doing something like this:

llSetRot(llGetRot() - llEuler2Rot(<0,0,90>;));

Or if the tail was already at ZERO_ROTATION, you set it to the new rotation like so:

llSetRot(llEuler2Rot(<0,0,315>;)); (or hardcode the rotation so it doesn't have to do extra math)

And don't forget to stop the llTargetOmega or it will continue from the newly rotated spot.

Basically the script I'm talking about would look like this:

CODE
event()
{
// Tail is assumed to be at <0,0,45> rotation
llTargetOmega(<0,0,1>, PI / 4, 1.0); // Travel a quarter circle...
llSleep(1.0); // ... timed to one second.
llTargetOmega(<0,0,0>, 0, 0); // Stop the rotation
// Set tail to <0,0,315> rotation, which is where llTargetOmega
// should have put it after one sec.
llSetRot(llEuler2Rot(<0,0,315>));
}


Hopefully I've explained enough that you can do the math required for any other rotations you'd want to do. Please note that llSetRot() has a 0.2s built in scriptdelay. Your script will pause for roughly 0.2s after calling it, queuing any events that happen during that time. That is, if you kill llTargetOmega after calling llSetRot, you might get an additional 0.2s of clientside rotation.

Also, on busy sims, your timing is going to be all screwed up, and your tail may keep spinning without stopping, or go very very slowly then lurch into the new llSetRot, or whatnot.

Go ahead and contact me ingame if you have questions. I've been up entirely too late and I'm not sure how much of this made sense.