-
What do you want to achieve? Keep it simple and clear!
Used a Raycast to create rocks around the player to make it look like a crater -
What is the issue? Include screenshots / videos if possible!
The circle is not centered where the player is, its offset is a bit to the side. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried going to Discord hidden devs, no one knew the solution, i posted in here a couple of times and no one responded, and i looked around on devforum and no one had this problem before.
--Code for positioning the rocks--
local rx = pos.X + rnd:NextNumber(-1,1)
local rz = pos.Z + rnd:NextNumber(-1, 1)
local lookAt = Vector3.new(rx, pos.Y, rz)
local orientation = Vector3.new(rnd:NextNumber(-60, 60), rnd:NextNumber(-60, 60), rnd:NextNumber(-60, 60))
local lv = CFrame.new(pos, lookAt).LookVector
local position = pos + (lv * radius * math.clamp(h/numCircles, 0.5, 1))
local cf = CFrame.new(position, pos + lv + orientation)
--Note: The "pos" is just HumanoidRootPart.Position, and yes, i have tried HumanoidRootPart.CFrame.Position and it still didnt center--
local floorRay = workspace:Raycast(cf.Position + Vector3.new(0, 3, 0), position - Vector3.new(0, 100, 0), rp)
if floorRay and floorRay.Instance.Anchored then
local colour = floorRay.Instance.Color
local mat = floorRay.Instance.Material
rock.Size = Vector3.new(0, 0, 0)
rock.Position = floorRay.Position
rock.Orientation = orientation
rock.CanCollide = false
rock.Anchored = true
rock.TopSurface = Enum.SurfaceType.Smooth
rock.Color = colour or Color3.fromRGB(83, 86, 90)
rock.Material = mat or Enum.Material.Slate
rock.Parent = workspace["Effects"]
TweenModule.obj(rock, "Quad", "Out", 0.2, {Size = rockSize})
task.spawn(function()
task.wait(5)
local fallTween = ts:Create(rock, rocksTI, {Position = rock.Position - Vector3.new(0, rock.Size.Y/2, 0)})
fallTween:Play()
fallTween.Completed:Wait()
rock:Destroy()
end)
end
Heres what the crater looks like: