Sean Gorham
Stopped making sense
Join date: 5 Mar 2005
Posts: 229
|
05-10-2005 17:05
Recently I tried using the moving_start() and moving_end events in a physical object: default { moving_start() { llOwnerSay("moving..."); }
moving_end() { llOwnerSay("stopped moving."); }
state_entry() { llOwnerSay("Ready."); } } Nothing super complex, obviously. What I noticed was physical objects seem to trigger these events in an inconsistent manner. I'd have a physical box with this script in it just sitting on another prim (or on the ground) and I'd see it spit out "moving..." messages. Am I missing something here? I wanted to use these events for the obvious reason -- to determine if a physical object started and stopped moving. I can do something similar with a timer and calls to llGetVel(), but that seems a lot clunkier.
|
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
|
05-10-2005 17:54
The physics system seems to have a problem with collisions that occur constantly. You might want to try something with the collision event, or a slow timer that uses llGetVel. It all depends on what you want to do.
_____________________
---
|
Sean Gorham
Stopped making sense
Join date: 5 Mar 2005
Posts: 229
|
05-10-2005 19:27
Yes, I've played with both the collision events and llGetVel. So far, llGetVel with a timer twice a second seems to work the best. I was just hoping to use the most efficient method for measuring motion (or lack of), and the motion events seemed the logical place to start. Here's what I finally came up with: state moving { state_entry() { llSetTimerEvent(0.5); moveit(); // impulses etc. get applied in this function }
timer() { float current_speed;
current_speed = llVecMag(llGetVel()); if(current_speed < 0.00001) { llSetTimerEvent(0); llOwnerSay("Stopped."); state default; } } }
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
05-11-2005 09:26
Sadly, all of my experience with trying to use moving_start and moving_end has proven it to be far too erratic and unreliable to get anything done.
|
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
|
05-11-2005 11:17
...agreed. I remember that I ended up using a timer to poll llGetVel() until it reported ZERO_VECTOR to detect the stop of a thrown physical ball...
/esc
_____________________
http://slurl.com/secondlife/Together
|