Collision position

Hey! How can i get the position where the collision between two objects happend.

1 Like
script.Parent.Touched:Connect(function(hit)
    print("Touched at "..tostring(script.Parent.Position))--tostring() converts the Vector3 value to string
    --print("Touched part's position "..tostring(hit.Position))
end)

It’s dependent on context, for example if two spheres collide you could get the contact point by using the direction between the two positions easily. Although It’s nowhere near as simple when you have other shapes with non-symmetrical sizes.

I think the only possible way would be to brute force it with lots of raycasts with some complex shape & size context, very performance expensive and likely hard to code.

I don’t think it’s all that possible to get a contact position.

It ain’t that hard to code, let me explain:
My idea is to get the position and size of each of the objects which is in touch with the part and get the part’s position and size then check between which points the collision occurs then return the positions all together divided by the number of positions.

The point of this post was to see if there is an easier way or if there is someone who already has some kind of code for this thing.

I’ll get back with a code for this thing.

Also i needed this because i see that i really need to make the physics of the ball (i’m trying to make a golf game and only setting velocity turns out to be very… useless because the ball goes crazy, it simply moves around in lag and never stops)

This ain’t what i meant, @Mechstreme .
That’s the position of the touched part not the point/position where the collision occurs