how to calculate the position of the raycast where it hit a part in roblolx lua?
here is a image:
i want to get the pos of where they meet, not the pos of the wall
how to calculate the position of the raycast where it hit a part in roblolx lua?
here is a image:
i want to get the pos of where they meet, not the pos of the wall
yo, i dont want the pos of the part, i want the position of the intersection.
the ray.Position did not work as i already tested it
<Raycast>.Position is how you get the position of hit, if it did not work for you, you either did it wrong or checked it wrong.
here is my very professional script:
local tool = script.Parent
local laser = tool.LaserPointer.RedPart
local lasered = false
local length = 20
local ray = nil
tool.Equipped:Connect(function()
if laser then
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Blacklist
params.FilterDescendantsInstances = {tool}
local raycast = workspace:Raycast(laser.Position, laser.CFrame.LookVector * length, params)
local hit = raycast and raycast.Instance
if hit then
ray = Instance.new("Part", tool)
ray.Name = "StartPoint"
ray.Anchored = true
ray.Size = Vector3.new(0.2, 0.2, 0.2)
ray.BrickColor = BrickColor.Red()
ray.Material = Enum.Material.Neon
ray.CanCollide = false
ray.Transparency = 0
ray.Position = -- here the pos of the thing
end
end
end)
its a client script, idk if it matters
You aren’t getting the position of your ray, you are getting the position of the part you just created and called “ray”, to get the position of the raycast do raycast.Position
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.