-
I want to make it so the player actually slides according to the slope (for example if the player is sliding down on a wedge, it’s body will also face the slope of the wedge.)
-
I have spent for the last 5-7 hours of the day (which is now midnight) trying to figure out how to make the player actually slide and face it, I have failed countless amounts of times making not much of a progress.
A GIF regarding of it: https://gyazo.com/40f02ea893db8a89e1ae6e69c23ac37c
- I have looked through the devforum, I have found several articles regarding of sliding mechanism’s slope and none of them really helped with the issue, I have tried using the root’s CFrame or even BodyGyro and none worked even though the method was supposedly the right one for it or at least I think it was the right one.
The script itself:
local Event = game:GetService("ReplicatedStorage"):WaitForChild("Signals").SlideEvent
local Gyro = Instance.new("BodyGyro")
local Velocity = Instance.new("BodyVelocity")
Event.OnServerEvent:Connect(function(player, character, rayPosition, rayNormal)
Gyro.Parent = character:WaitForChild("HumanoidRootPart")
local vector = player.Character.HumanoidRootPart.CFrame:VectorToObjectSpace(rayNormal)
Gyro.CFrame = CFrame.new(character:WaitForChild("HumanoidRootPart").Position, character:WaitForChild("HumanoidRootPart").Position + rayNormal)
Gyro.MaxTorque = Vector3.new(0, math.huge, 0 )
Velocity.MaxForce = Vector3.new(math.huge,20,math.huge)
Velocity.Parent = character.HumanoidRootPart
Velocity.Velocity = character.HumanoidRootPart.CFrame.LookVector * 2
character:WaitForChild("Humanoid").AutoRotate = false
character:WaitForChild("Humanoid").HipHeight = -2
end)