Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How can I trigger a collision event to work with attachment?

Inspira Aeon
Registered User
Join date: 15 Nov 2007
Posts: 3
12-06-2007 02:51
Currently, I have a vest (linked object) and I want to change one of the prim colour when a bullet hits it. But I realise attachment does not with collision event. llVolumeDetect also does not work with attachment. Anyone had any ideas how I can do it?? Thanks :-)
Sekker Thirroul
Registered User
Join date: 27 Aug 2006
Posts: 28
12-06-2007 02:59
I'm not sure on this one, I think on an attachment you get constant colisions with the ground since it counts the entire avetar, most none health combat systems use the bullet checking to see if its hit an av then sending an message or the gun checking to see if thers an av in its vertual fireing cone and sending a hit message if there is.

I guess its posible to filter out ground and avetar colisions so than only bumping prims can triger it but not sure how reliable it would be.

But if you are using this in a sim with a standard combat system it might be worth asking what channels that system uses and haveing your vest key to the hit messages rather than trying to do it collision based.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
12-06-2007 04:13
It is not possible to detect collisions in attachments or with attachments.

Due to the client side handling of animations the server could not possibly tell where which attachment is at any given moment.

You can only detect collisions with the avatars bounding box. So your bullet will have to detect the collision, communicate it to the attachment and then your attachment will have to figure out based on the avatars position and rotation if it has been "hit" or not.

Trying to get an attachments position or rotation will always return the avatars position and rotation.
Inspira Aeon
Registered User
Join date: 15 Nov 2007
Posts: 3
12-09-2007 17:54
If i put the collsion scriptin the bullet, it can detect the avatr that the bullet hits.. but how can i communicate with the attachment that the avatar is wearing?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
12-09-2007 21:21
have the bullet say a message on an off channel, the attachment should be listening for it, poof, communicated hit
_____________________
|
| . "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...
| -
Inspira Aeon
Registered User
Join date: 15 Nov 2007
Posts: 3
12-09-2007 21:44
then if i want to get the specific prim in a linked object that is being hit by the bullet will i be able to that? because I want it such that s the attachment lsiten and knwo that it is being hit i want to change the colour of that specific prim on the attachment where it is being hit.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
12-10-2007 04:26
(This is all just restating Squirrel's explanation.)

In short, no. At least not accurately, in any way corresponding to how it looks on the screen. Each client sorta decides on its own where the attachments are supposed to appear as it animates the avatar locally. Collisions happen on the sim, so the llDetectedPos of a collision may give a hint as to which part of the avatar was hit, but if the avatar were in mid-backflip during the hit, all bets are off. And it doesn't have to be that extreme: just try slowly rotating your avatar and note that the client only updates the rotation of the avatar after the agent's rotation has changed significantly on the sim. So not only can't you know which prim was hit in a multi-prim attachment, you can't even know which attachment was hit, if any. But you could do the calculations with llDetectedPos from the projectile and the avatar's rot & pos and just guess; you'll be right some of the time.