Jump to content

Can Object Detect Which Child Prim it Hit?


BrownBoxStudio
 Share

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

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

Recommended Posts

Can an object, not the one in the child prim's linkset, detect a child prim that it hit? I've read the wiki page but I am still unsure if what I am trying to do is possible. 

I have a base that is always colliding with a few objects and I want to detect when certain child prim are hit. Although there are multiple objects colliding causing just enough collision calls that the script has trouble tracking them as I would like. Thought it might be easier if I can have each object track it's own movement and send a message when changes happen instead of the base tracking all collisions at all times. When the base tracks all collisions at all times it tends to miss some collision changes.

To give a physical description this is a skeeball game. The ball starts colliding when it's rolling so I can't use start collision as the ball, object, is always colliding and I then have to track all collisions and watch for prim changes. 

Maybe someone else has experience with this? This is the final "error" I am trying to fix on my game and have been stuck on it for a couple solid days now. Any help is appreciated. 

 

Or another idea I had was to detect the collision from the child prim but I think the same problem would arise. Collision checking from a child prim still checks all the collisions from the rest of the linkset right? 

Link to comment
Share on other sites

Instead of tracking collisions, why not track the position of the ball? You know where all the stationary objects are, so if the ball is within (ball_diameter + Object_diameter)/2 of an object's position, it has hit it.  You can double check perhaps by monitoring the ball's normalized velocity ( llVecNorm(llGetVel()) ) to see if the ball changed direction by more than some small amount.

Link to comment
Share on other sites

So I take it then having the ball detect which child prim it hit through collision isn't possible? Interesting idea though, to track the position. Was just thinking I might have trouble doing so if I am tracking an area that is rectangular as opposed to square/spherical. Although I just thought of a way I can setup the lane itself so there are no rectangular areas that need to be tracked. Might even be simpler than checking the velocity as depending on where I put the tracking spots I can assume if ball is near tracking spot it probably isn't going to move to any other tracking spot. 

Thanks so much, that might do really well! 

Link to comment
Share on other sites


BrownBoxStudio wrote:

So I take it then having the ball detect which child prim it hit through collision isn't possible? [ .... ]

Oh, I didn't say that.  Just use llDetectedLinkNumber() in the object that's being hit and then send a message to the ball or wherever.  I was just thinking from the perspective of the ball. If your whole system is set on the ball determning what it hit, even if it's hitting passive objects, tracking its position seems simpler, especially if the objects are never going to move.

Link to comment
Share on other sites

Ah, I was thinking form the perspective of the ball too, if the ball itself could detect the link number that it hit, without the base detecting the collision. The base currently detects link number collision but the amount of collisions is what causes trouble right now. But yea, the base will never move so detecting position shouldn't be too hard. 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2524 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...