Rychaella
(SkowDy)
January 26, 2023, 4:02am
#1
Hi, I’m trying to make a sliding mechanic using humanoid.HipHeight to go through the small places but I need to make it so that when you slide horizontally on a slope gravity takes you down something like this:
and the slider i made only works on flat places
1 Like
If you are using a physics solution with no humanoids.
You can turn your character into a invisible sphere and apply a force to it, it will automatically roll downwards due to the normal force and gravity.
Thats what EgoMoose and X_O has done for their sliding system:
I made a character controller that allows for a style of movement you would typically find in 3D platformer style games. It works with both keyboards and controllers and could easily be extended to mobile with a little extra work. I decided to release this to give those interested in making a game like this an idea of one way to put this together.
Move Set
Double jump: (Press jump twice)
[2018-10-30_14-57-43]
High jump: (Crouch and jump while not moving)
[2018-10-30_14-57-56]
Long jump: (C…
If you are looking for a direction to manually simulate physics:
You can get the horizontal XZ component of the normal vector which is the direction to slide down.
RayPart.CFrame = CFrame.new(RayCast.Position + Vector3.new(0,6,0))
local normalHorizontalComponent = RayCast.Normal*Vector3.new(1,0,1)
if normalHorizontalComponent .Magnitude > 0.001 then
RayPart.CFrame += normalHorizontalComponent.Unit * 0.1
end
You can cross product it as well:
If you want to get the CFrame pointing downards of a slope you can use cross product.
However keep in mind this only works if the slope is uneven and not perfectly flat or else the cross product will fail.
local char = script.Parent
local HRP = char:WaitForChild("HumanoidRootPart")
local part =Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(2,1,5)
part.CanCollide = false
part.Parent = workspace
part.FrontSurface = Enum.SurfaceType.Motor
local downVector = -Vect…
1 Like
Also you can look into the beta physics character controller which is physics based and can slide down, you can also make your own controller which I have done. Many different ways to do it:
Past Updates...
v0.1
Our first step in Humanoid Componentization (more info coming soon) begins with a new physics controller. We’ve rebuilt it from the ground up using the same internal objects and constraints that make up the rest of our physics engine. This should provide a more robust and physically accurate controller, open up more customization options, and simplify optimizations down the road.
Additionally, our goal is to fix outstanding bugs, eliminate mysterious extreme forces, and m…
1 Like