Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Touched event get point of contact?

Asked by
asadefa 55
5 years ago

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.

script.Parent.Touched:Connect(function(hit)
    --get the point of contact
end)

2 answers

Log in to vote
1
Answered by
Despayr 505 Moderation Voter
5 years ago

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.

script.Parent.Touched:Connect(function(hit)

local expl = game.ServerStorage.Explosion:Clone()
expl.Position = script.Parent.Position
expl.Parent = workspace





end)
Ad
Log in to vote
1
Answered by
poke7667 142
5 years ago

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

Answer this question