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

How Would I go About Getting the Normal of a Target's Surface?

Asked by 5 years ago
Edited 5 years ago

I am trying to make a tool that creates and moves a part in the direction of a surface's normal (i.e perpendicular) vector, determined by a mouseclick. I have the tool itself along with the target detection completed; however, I need to make the part that is created move outwards from whatever surface is clicked (if I click the bottom of a brick, the new part would move downwards from it, and if I clicked the side of a brick at a 45 degree angle, it would come straight out of that side, etc.)

How would I go about doing this? Thanks in advance.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If you already have the clicking down, then you need to get the mouse object passed in from the Equipped event in tool (First parameter), and make a new instance of a part facing the direction by setting the CFrame of the new part to CFrame.new(Tool.Handle.Position, Mouse.Hit.P) add a BodyVelocity to it, and set the velocity to Mouse.Hit.p, mess around with the speed by dividing / multiplying.

Mouse.Hit.p is the position of where you clicked.

0
I don't think this answers my question. Nothing should come out of the tool itself. That's just how I've chosen to make this occur. The part should be created on the surface clicked and then proceed to move outwards along the normal vector of that surface. corncob567 275 — 5y
Ad

Answer this question