How to align attachments to raycast normals?

The title is quite self-explanatory. I cannot really wrap my head around attachment shenanigans, and how they work… So how do I script that?

2 Likes

Can’t you just do RaycastResult.Normal? I looked at the documentation and there’s already a variable which is contained with the RaycastResult: ( Scroll down to Detecting Hits )

local rayc = -- your raycast result
local atta = -- your attachment
atta.WorldCFrame = CFrame.new(rayc.Position,rayc.Position+rayc.Normal)

This is just a line of code I know off the top of my head, but I wrote it this time in the forum so fix any errors you get.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.