Does anyone have any idea how they made it so that this beam is attached to the surface regarding of its position?
https://gyazo.com/bb36981b19e21954cad2a8c1980722b7
As you can see from this GIF, the beam detects the surface of where it is being placed and adjusts itself to stick on the surface.
1 Like
TheDevvy
(Eldon)
April 25, 2020, 12:18pm
#2
it’s basically a part that when you click it uses “Mouse.HIt” and goes to the new “Mouse.Hit” every frame and the part as a decal on it. Give me a minute ill make a demo
Oh so its not a beam?
Okay I’ll wait, thank you!
TheDevvy
(Eldon)
April 25, 2020, 12:33pm
#4
local UIS = game:GetService("UserInputService")
local Mouse = game.Players.LocalPlayer:GetMouse()
local Event = nil
Mouse.Button1Down:Connect(function()
newPart = Instance.new("Part", game.Workspace)
newPart.Name = "PlayerPart"
newPart.CFrame = Mouse.Hit
newPart.Orientation = Vector3.new(0,0,0)
newPart.Anchored = true
newPart.CanCollide = false
local firstCFrame = Mouse.Hit
Event = game:GetService("RunService").Heartbeat:Connect(function()
local Size = firstCFrame.Position - Mouse.Hit.Position
newPart.Size = Vector3.new(Size.X, 1, Size.Z)
end)
end)
Mouse.Button1Up:Connect(function()
Event:Disconnect()
end)
it’s not filtering enabled compliant so if you want the parts to replicate use a remoteevent
https://gyazo.com/21407ae9e92246a0a1b729975213db92
2 Likes
Does it really work this way?
Cause the line can bend on hills and slopes in a almost accurate shape
1 Like
TheDevvy
(Eldon)
April 25, 2020, 12:37pm
#6
well, not really, they probably did it a different way, I set the Orientation to 0 because I was working on a flat plane and it was causing issues. So they probably did it different. With enough time I could’ve done that, but I don’t feel like spending an hour on this. Sorry!
1 Like
The way they did it is that the line detects the surface of the terrain and adjusts itself to fit to its shape which idk how they did that.
https://gyazo.com/e1f220b176f57be6d1e37f5e5c50120a
But anyways thank you for the help.
1 Like
TheDevvy
(Eldon)
April 25, 2020, 12:40pm
#8
You can use topography or something like that, there is probably something in the API ref for it
1 Like