Rotate part in the direction of the raycast normal

Im trying to make bullet holes rotate the right way based on the raycast normal…
hole.Orientation = raycast.normal
isint working… How would i do this correctly?

The normal of a raycast is a direction vector not an orientation, so first make sure you have a part with your bullet hole where the decal is on the front face of the part.

Then you can do something like this:

hole.CFrame = CFrame.lookAt(raycast.Position, raycast.Position + raycast.Normal)

This code sets the cframe of your bullet hole to be looking away from the surface which is the same direction as the surface normal.

11 Likes