Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Avatar physics

Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
05-30-2007 11:59
Complete new here, so pardon if this is a stupid question. I am trying to move an attached object relative to the phycical movement of the avatar. Is there a way to get the direction and velocity of the avatar from the object script? An example is say the avatar is wearing a big sombrero and then jumps straight up. I want to apply a relative downward force to the hat so it reacts to the avatars movement.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-30-2007 13:02
Well, you can get the movement of the avatar with llGetVel(), but it would have to be done in a timer, or some other continuous event to for you to detect when it was sufficient to alter the hat.

Might even use the moving* events, but they might be a little dicey at times.
Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
05-30-2007 13:12
So llGetVel() will get the movement of the avatar and not the movement of the current object? Interesting, I guess I am a little confused with the scope of these functions.
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
05-30-2007 13:22
Yes, because attachments do not move relative to the avatar from the server's point-of-view. They only exist in a psuedospace called "attachment space", which is fixed relative to the avatar. Most function calls which return info for an object also return the same info for an avatar when attached. llGetPos(), llGetRot(), etc.
Dopel Dollinger
Registered User
Join date: 25 May 2007
Posts: 14
05-30-2007 13:23
Great! Thanks for clearing that up for me.