I’m coding a sliding mechanic that maintains velocity when you slide on a wedge. I’ve used Raycasting and mathematical formulas to obtain the angle I needed, but I can’t seem to make the linear velocity parallel to the slope [see screenshot for a better explanation].
If anyone knows how I could do this, I’m all ears because my last line of script doesn’t take the real angle into account.
local function Slide() print("Slide") local PartSize = SlideDownRaycastResult.Instance.Size local X = PartSize.Z^2 + PartSize.Y^2 local Angle = math.deg(SlideDownRaycastResult.Instance.Size.Y/math.sqrt(X)) LinearVelocity.MaxForce = 40000 local Force = 5 LinearVelocity.VectorVelocity = SlideDownRaycastResult.Instance.CFrame.UpVector * -1 * Force + Vector3.new(0,-Angle,-Angle) end 