noting that im a beginner so im quite slow
comparison
where its placed:
the script:
local wedge = script.Parent
local randomAxis = Vector3.new(1,0,0) -- Read this in the EgoMoose article
local DOWN = -Vector3.new(0,500,0)
local function getRotationBetween(u, v, axis)
local dot, uxv = u:Dot(v), u:Cross(v)
if (dot < -0.99999) then return CFrame.fromAxisAngle(axis, math.pi) end
return CFrame.new(0, 0, 0, uxv.x, uxv.y, uxv.z, 1 + dot)
end
while true do
local dt = wait()
local rayResult = workspace:Raycast(wedge.Position,-1000*wedge.CFrame.UpVector)
if rayResult then
local rotateToFloorCFrame = getRotationBetween(wedge.CFrame.UpVector,rayResult.Normal,randomAxis)
local goalCF = rotateToFloorCFrame*wedge.CFrame
wedge.CFrame = wedge.CFrame:Lerp(goalCF,5*dt).Rotation +wedge.CFrame.Position
end
end