Hi guys, so I want to make a tool in which you can click one point and then another and it’ll build a part between them (which then becomes police tape). The only issue is I’m not really sure how go get the correct information as to how exactly the part will be orientated. (for example if I have one lower or at an angle the tape needs to adjust to that). Any ideas are appreciated
2 Likes
You could use RayCasting to determine where the tape needs to be.
I would probably just cast a ray from the player’s tool or HumanoidRootPart to the Mouse.Hit to determine Point A and Point B of the ray.
Here is a wiki link on raycasting that should help.
Try something like this.
local tapeThickness = -- put a very small value here
local tapeWidth = -- put a value here
local distance = (pointB-pointA) -- distance on each axis, which means this is also the direction from pointA to pointB
local mag = distance.Magnitude
local CFrame = CFrame.new(pointA+distance/2, pointB) -- the first value is the position, and the second one is where it faces.
local size = Vector3.new(tapeThickness, tapeWidth, mag)
You can also rotate the tape with CFrame.Angles, if necessary, and change the order of the size values based on that. I haven’t tested this, but hopefully it works.
2 Likes