Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Determining collision point -- object to object

Fenrir Reitveld
Crazy? Don't mind if I do
Join date: 20 Apr 2005
Posts: 459
02-28-2006 15:36
Search isn't working ATM for me; So if this thread is redundant, I apologize in advance.

I'm looking for information on detecting object to object collision points. All I can see in the wiki is just getting the collider's position via llDetectedPos(). But as far as I can tell from the wiki, only land collisions support returning the actual collision point. Am I just out of luck?

I need this data in order to rez a prim at the collision point, based on the detected collision point's normal. (Imagine a bullet striking a surface and leaving behind a decal in a typical 3D game.)
Starax Statosky
Unregistered User
Join date: 23 Dec 2003
Posts: 1,099
03-01-2006 01:13
You've not had a reply, so I'll have a go.

Errr...

Hmm...

I know!!

How about firing 3 bullets out of your gun, all at the same time! and then when each one hits the target's surface. you freeze them and calculate their angle relative to eachother to get the normal. Then stamp your decal down.

Hey, I'm trying!!!


Or:

Err...

Okay, I'm going to bed.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
03-01-2006 01:34
At the point the collision occurs for the bullet its position can be determined by an llGetPos() in a collision_start() event. Depending on the shape of the bullet etc. you might have to add an offset for size of bullet.

That could then be used to define the position to rez the hit "splash" effect.
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
03-01-2006 05:31
From: Eloise Pasteur
At the point the collision occurs for the bullet its position can be determined by an llGetPos() in a collision_start() event. Depending on the shape of the bullet etc. you might have to add an offset for size of bullet.

That could then be used to define the position to rez the hit "splash" effect.


This sounds like the best way I can think of to do it – on collision, get the velocity the bullet was moving at and our bullet’s size halved… And then use that as an offset and slap down the decal – I don’t know any specific function that tells you the actual exact point of collision…
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-01-2006 05:50
Eloies: that won't tell you the angle to place the decal at.

Starax' solution is probably the only way you'll be able to do it. To keep the probes close enough, and to avoid having one clip the corner of a prim on the way, you could have the bullet res the probes on impact.
Fenrir Reitveld
Crazy? Don't mind if I do
Join date: 20 Apr 2005
Posts: 459
03-01-2006 13:18
Logan: Using velocity may work... That effectively gives me a direction vector, though there might be issues when the object is bouncing along the floor/ground. (This isn't a bullet, even though I used that as an example, so it's not always moving at high speed.)

I hate to use probes; The mere fact I am rezzing visual effect prims for collisions is enough to give me the willies. (Considering how your typical gun that spews out shells and whatnot can crash a sim!)

Thanks, everybody, for the suggestions. This gives me something to try. :)