Collision... arrows bounce off and hit more than one ring
|
|
Vivienne Daguerre
Registered User
Join date: 12 Apr 2004
Posts: 28
|
08-08-2006 11:18
I am a new scripter. I have made an archery target with separate rings, each scripted to voice the number of points an arrow collides with according to the ring it strikes.
The problem is that an arrow will bounce and hit more than one ring, or even pierce one on an angle and sink into a second, so I will get two or three scores back from one arrow. the solution would be to tell a score keeper prim to accept only the first score it receives and ignore the others that come after, and yet know when a different arrow is fired. I was thinking I could have a Fire signal come on when it is ok to fire the next arrow.
Any suggestions about what functions I would use to do this? Any suggestions? I am brand new to scripting so forgive my lack of knowledge please. A shove in the right direction would help me greatly.
I thank you all in advance.
|
|
Gearsawe Stonecutter
Over there
Join date: 14 Sep 2005
Posts: 614
|
08-08-2006 11:29
The one thing I can think of off hand is have the arrow say what it collided with and have a check in its collions to see if it collided with the target. After the first collision it will no longer say any more collisions reported.
Anther way is change states. your "default" and lets say "hit state" where the "hit state" would be called from within the defaults collision event.
|
|
Vivienne Daguerre
Registered User
Join date: 12 Apr 2004
Posts: 28
|
08-08-2006 11:48
Thank you! I like the hit state idea! I will try that 
|
|
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
|
08-08-2006 12:19
Probably an easier thing, if you've got the score/hit scripts in the target rings and not the arrows, would be to just have it sleep after the first collision (might have to send it to another state to sleep and then come back to avoid cached collisions or something)
Shouldn't need long, and all you would have to do is have it report the score After the sleep message, then return back to the normal state.
The person will know that he must wait a second for his score before firing again.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
08-08-2006 13:20
Use only one collision event handler in the target. Either register the arrow in a list of recent hits and ignore further collisions from that arrow, or use llMinEventDelay(). Instead or in addition, you could calculate the, "ring that was hit," based on the actual relative vector location (and possibly velocity) of the arrow instead of what prim it actually hits. That means you could actually use llVolumeDetect() on a prim surrounding the target and get only one collision_start event (unless the arrow bounces away, hits something, and ricochets back into the volume, which is certainly possible I suppose). If you do this you should probably try to make the calculation match the actual prim/texture dimensions as closely as possible of course.  Oh. Another thing you can do is turn of physics on the arrow as soon as it registers a collision. That could help a little. It's also a nice way to make your arrows, "stick."
|
|
Vivienne Daguerre
Registered User
Join date: 12 Apr 2004
Posts: 28
|
08-09-2006 04:31
OK, so far none of this is working. By the way, the scripts are in each of the 10 rings, not in the arrows. People have their own bows and arrows and I would like the target to work with any bow and arrow.
|
|
Vivienne Daguerre
Registered User
Join date: 12 Apr 2004
Posts: 28
|
Aaaaargh
08-09-2006 05:27
Ok.. I am stumped, totally. I will pay 5000 L to anyone who can script a target to work with any bow and arrow (or anything that fires a physical object) to the following specs. All scripting must be in the target. For this price, I do expect open source and permission to use the script in targets and archery systems I might sell in future. The target must be of a FITA type. It has a yellow bullseye and 9 rings from inside out as follows: Bullseye: Yellow, 10 points Yellow, 9 points Red, 8 points Red, 7 points Blue, 6 points Blue, 5 points Black, 4 points Black, 3 points White, 2 points White, 1 point For a picture go here: http://en.wikipedia.org/wiki/Archery#ScoringThere needs to be a scorekeeper prim that tells who shot the arrow, what that arrow score was, and the running total score. Each person will be able to shoot 5 arrows. After 5 arrows it should say Final Total and name and Final Score. I would also like a scoreboard that will keep track of contestants, displaying their name and their score. If this is difficult or there are limitations to this, please talk to me about options, what can be done, difficulty level and potential price changes.
|
|
Eaglebird Cameron
YTMND *********
Join date: 1 Jul 2006
Posts: 68
|
08-09-2006 11:28
you could try collision(vector pos) { llSetStatus(STATUS_PHYSICS, FALSE); //to make it stop and look like it's 'stuck' to the target llSetStatus(STATUS_PHANTOM, TRUE); //To make it passable so avatars won't somehow get stuck on it. }
or you could just do collision { llDie(); }
which will remove the arrow altogether. Not sure if they'll interfere with the point scoring system or not though.
|
|
Vivienne Daguerre
Registered User
Join date: 12 Apr 2004
Posts: 28
|
Problem Solved!
08-13-2006 06:54
Thanks to the wonderful assistance of Scripting Teacher extraordinaire, Dirty McLean, I have a working target!!  Thank you all for your help 
|