Jump to content

Start attached prim movement when avatar moves


Max Pitre
 Share

You are about to reply to a thread that has been inactive for 1849 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Is there a way to move/rotate or whatever an attachment when your avatar starts walking? Can a script detect avatar leg movement? For instance, I have a robot avatar that moves around on a ball, I want that ball to rotate when the avatar moves/walks. That make sense? 

Link to comment
Share on other sites

No, a script cannot detect leg movement.  Leg movement is an animation, which is all handled client-side.  That's not really what you are asking for, though.  If you want to know whether the avatar is walking, ask

if ( llGetAgentInfo( avatar_UUID & AGENT_WALKING )) ,

where you get avatar_UUID by whatever means is most reasonable in your script ( llDetectedKey(0), llGetOwner(), etc.)

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

There's also the moving_start and moving_end events, which are triggered in an attachment's scripts when the avatar starts and stops moving, though the type of movement isn't limited to just walking.

If you want to be walking-specific, you could use Rolig's test for that in the moving_start event and start the rotation when appropriate, and then stop it in the moving_end event.

  • Like 1
Link to comment
Share on other sites

You can also use llTakeControls, and when the avatar starts or stops moving by keyboard control, the control event is triggered. You would then check if agent is walking with the first snippet that rolig suggested. When that returns true, you want the ball to move. Then follow that test with an else test, which is will pass when the avatar is not walking, and that is where you want to make the ball stop moving

 

ETA: also the advantage of the llTakeControls, is that it works in no-script areas

Edited by Ruthven Willenov
Additional info
Link to comment
Share on other sites

If you do use the control event, take care that you structure your tests/checks to only respond to the initial key press and final key release. Otherwise you may get into a situation where your script is constantly restarting the animate ball code  - because the control event will continuously be called as long as any captured key is depressed.

Edited by Fenix Eldritch
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1849 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...