Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function visualize(startPos, endPos, color) --draw the ray
- local distance = (endPos - startPos).magnitude
- local rayPart = Instance.new("Part", workspace)
- rayPart.Name = "RayPart"
- rayPart.BrickColor = BrickColor.new(color)
- rayPart.Transparency = 0.5
- rayPart.Anchored = true
- rayPart.CanCollide = false
- rayPart.TopSurface = Enum.SurfaceType.Smooth
- rayPart.BottomSurface = Enum.SurfaceType.Smooth
- rayPart.formFactor = Enum.FormFactor.Custom
- rayPart.Size = Vector3.new(0.2, 0.2, distance)
- rayPart.CFrame = CFrame.new(endPos, startPos) * CFrame.new(0, 0, -distance/2)
- table.insert(parts, rayPart)
- game:GetService("Debris"):AddItem(rayPart, 1/60)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement