Is there a way to detect what face of a part was touched on a touch event? If so, how?
1 Like
The Touched event itself provides no information on the face of a part that was touched. It does, however, tell you what the other part was, and you can use that to raycast from the other part to the detector part. RaycastResult contains the NormalId.
Example script
trigger.Touched:Connect(function(otherPart)
-- Limit the raycast to only detect the part that's detecting the collisions
local params = RaycastParams.new()
params.FilterDescendantsInstances = {trigger}
params.FilterType = Enum.RaycastFilterType.Whitelist
-- Now raycast from the otherPart to the trigger part
local direction = trigger.Position - otherPart.Position
local result = workspace:Raycast(otherPart.Position, direction, params)
local normal = result.Normal
-- Other stuff
end)
3 Likes