I am trying to make an explosion for my projectile. How can get the point of contact when the touched event is fired? The touched event gives me the the part I hit. How can I get the exact point of contact.
1 | script.Parent.Touched:Connect( function (hit) |
2 | --get the point of contact |
3 | end ) |
Not sure if it is possible, but there is a way around this. As soon as the part is touched, you could clone the explosion and set it's position to the part with the 'Touched' function connected to it.
01 | script.Parent.Touched:Connect( function (hit) |
02 |
03 | local expl = game.ServerStorage.Explosion:Clone() |
04 | expl.Position = script.Parent.Position |
05 | expl.Parent = workspace |
06 |
07 |
08 |
09 |
10 |
11 | end ) |
If you are doing a projectile, id recommend ray casting over this as I believe it works for a point of contact (it works for me at least). Here are the docs on: Raycasting