|
Adam Ramona
Registered User
Join date: 5 Jan 2005
Posts: 56
|
03-17-2008 18:35
I thought collision_start was raised once when object or agent starts colliding with task. Given that, the following script I would expect to rez one object per collision, then not to rez another until the object or agent has stopped colliding with the task and then starts colliding again. Yet in practice the script results in a constant stream of rezzed objects, stopped only by resetting the script. The rezzed objects are TEMP_ON_REZ.
default { state_entry() { llCollisionSound(llGetInventoryName(INVENTORY_SOUND,0),1.0); } collision_start(integer num_detected) { llRezObject("basilica ball",llGetPos(),ZERO_VECTOR,ZERO_ROTATION,0); } touch_start(integer total_number) { llPlaySound(llGetInventoryName(INVENTORY_SOUND,0),1.0); } on_rez(integer num) { llResetScript(); } }
Any clues most appreciated!
Adam
|
|
Bobbyb30 Zohari
SL Mentor Coach
Join date: 11 Nov 2006
Posts: 466
|
03-17-2008 18:40
the objects are being rezzed at the rezzers location resulting in a collision on rez=P
Simply change it to llGetPos() + <0,0,1> or however big your object is.
|
|
Adam Ramona
Registered User
Join date: 5 Jan 2005
Posts: 56
|
03-17-2008 19:19
Thanks bobby.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
03-17-2008 21:42
Also, lots of little collisions CAN happen, especially with avatars. When gravity or a movement key bumps an avatar up against something, it's not uncommon to see collision_start, collision_end, collision_start, collision_end, etc. So if you want to consider that kind of thing "one collision", you might need to keep track of the keys and/or times of the last collision events, and only start handling a "new" collision if no collision event (I'd include plain 'collision' just for bookkeeping) with an object of interest has occurred in the last <timeFrame> time.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
03-18-2008 00:05
could just make the collision detection window long with LlMinEventDelay, it should discard the duplicates
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|