-
What do you want to achieve? I want my placement system to keep parts on the ground, and not fly towards the camera
-
What is the issue? The model slowly moves toward your camera until moving the mouse away.
Flashing colors warning
- What solutions have you tried so far? I haven’t tried much besides looking it up, which got no results.
RunService.RenderStepped:Connect(function()
if placingStructure == true then
local unitRay = mouse.UnitRay
print(unitRay)
local ray = Ray.new(unitRay.Origin, unitRay.Direction * 100000)
local raycastParams = RaycastParams.new()
local raycastResult = game.Workspace:Raycast(ray.Origin,ray.Direction, raycastParams)
mouse.TargetFilter = previewObject
if raycastResult then
local objectCFrame = CFrame.new(raycastResult.Position.X, raycastResult.Position.Y, raycastResult.Position.Z)
local objectAngles = CFrame.Angles(0, math.rad(rotationAmount), 0)
previewObject:SetPrimaryPartCFrame(objectCFrame * objectAngles)
end
end
end)
Thanks for the help!