Okay, so im working on some sort of platformer movement heavily inspired by Super Mario 64.
I got punches, kicks and triple jumps working. But when I got to the dive part, I had no clue how to make the player slide. I tried PlatformStand with invisible blocks, but that didn't help. Usually the player would just do a flip. I tried gyros, and I don't think they helped that much. So what it is currently like (at the time of posting this) is you bounce when you land. But I need it to slide.
I can't really show footage of how the sliding works in-game, but I can show footage of how mine works.
Also, this script is for Void Script Builder. I was testing this in the main vip server I usually play with my friends on, which is why there is a castle map in the background.
Clip here: https://gyazo.com/1701d1fa72f5f10997a45c3836c4a8d9
Anyone know how to make it work better? Also, incase you're wondering about how the dive is done currently, here is some code:
function fling(what, to, force) local bv = Instance.new("BodyVelocity", what) --bv.MaxForce = Vector3.new(10000000000, 10000000000, 10000000000) bv.MaxForce = Vector3.new(force, force, force) bv.Velocity = to Debris:AddItem(bv, 0.05) end fling(root, root.CFrame.lookVector * 65 - Vector3.new(0, 21, 0), 1000000)
If you manage to help, thank you! :)
Oh, please note: I looked at EgoMoose's platformer, but I couldn't really understand it. Plus, since this is just a script for Void Script Builder, I didn't think I could really do what he did.
Edit: I played around for a while, and this is my new result:
It's still not really what I want, but until I get an answer I'll just leave it at this I guess: https://gyazo.com/749c530f2ea47fd3ca9f6a860304edcc
Oh also if you want here is the entire dive function (It's really messy right now)
local diving = false function Dive() if attack == false then bv.Parent = nil fling(root, root.CFrame.lookVector * 65 - Vector3.new(0, 21, 0), 1000000) local floor = RayCast(root.Position, (CFrame.new(root.Position, root.Position + Vector3.new(0, -1, 0))).lookVector, (char["UpperTorso"].Size.y + char["LowerTorso"].Size.y)+1.96+hum.HipHeight, char) if floor then hum:ChangeState("Jump") Swait(11) end coroutine.wrap(function() diving = true attack = true local down = 0 local x, y, z = root.CFrame:ToEulerAnglesYXZ() local newCF = CFrame.Angles(x, y, z) local Gyro = Instance.new("BodyGyro", root) Gyro.MaxTorque = Vector3.new(1000000,70000,1000000) Gyro.CFrame = CFrame.new(root.Position, (CFrame.new(root.CFrame.x, root.CFrame.y, root.CFrame.z) * CFrame.Angles(0, y, 0) * CFrame.new(0, 0, 3).p)) while diving do Swait() down = down + (Rad(3) / 1.5) if down > Rad(41) then down = Rad(41) end Gyro.CFrame = CFrame.new(root.Position, (CFrame.new(root.CFrame.x, root.CFrame.y, root.CFrame.z) * CFrame.Angles(0, y, 0) * CFrame.new(0, 0, 3).p)) hum.PlatformStand = true local floor = RayCast(root.Position, (CFrame.new(root.Position, root.Position + Vector3.new(0, -1, 0))).lookVector, (char["UpperTorso"].Size.y + char["LowerTorso"].Size.y)+2.86+hum.HipHeight, char) coroutine.resume(coroutine.create(function() if floor ~= nil then removeVelocity(char) --fling(root, root.CFrame.lookVector * 35 + Vector3.new(0, 2, 0), 10000000) local BV = Instance.new("BodyVelocity", root) BV.MaxForce = Vector3.new(10000000, 10, 10000000) BV.Velocity = root.CFrame.lookVector * 51 + Vector3.new(0, 2, 0) coroutine.resume(coroutine.create(function() local slide = 45 while diving and BV do air = true floor = shadow slide = slide - 12 slide.Velocity = root.CFrame.lookVector * slide end end)) Swait(9) diving = false hum.PlatformStand = false BV:Destroy() end if hum.Jump and floor ~= nil then removeVelocity(char) --fling(root, root.CFrame.lookVector * 35 + Vector3.new(0, 2, 0), 10000000) hum.PlatformStand = false --fling(root, root.CFrame.lookVector * 35 + Vector3.new(0, 2, 0), 1000000) end end)) speedy = 0.2 --[[ AnimateThing(char["LowerTorso"], ltnor * CFrame.new(0, -1.5, 0) * CFrame.Angles(Rad(-95 - 25), Rad(0), Rad(0)), speedy/2.25) AnimateThing(char["UpperTorso"], utnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperArm"], rsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(15), Rad(0)), speedy) AnimateThing(char["RightLowerArm"], rsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightHand"], rsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperArm"], lsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(-15), Rad(0)), speedy) AnimateThing(char["LeftLowerArm"], lsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftHand"], lsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperLeg"], rhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(6)), speedy) AnimateThing(char["RightLowerLeg"], rhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["RightFoot"], rhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperLeg"], lhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(-6)), speedy) AnimateThing(char["LeftLowerLeg"], lhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftFoot"], lhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["Head"], necknor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(95 + 5), Rad(0), Rad(0)), speedy) ]] if diving == false then air = false end if floor == nil then AnimateThing(char["LowerTorso"], ltnor * CFrame.new(0, -1.5, 0) * CFrame.Angles(Rad(-95 - 1) - down, Rad(0), Rad(0)), speedy*1.1) AnimateThing(char["UpperTorso"], utnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperArm"], rsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(15), Rad(0)), speedy) AnimateThing(char["RightLowerArm"], rsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightHand"], rsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperArm"], lsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(-15), Rad(0)), speedy) AnimateThing(char["LeftLowerArm"], lsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftHand"], lsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperLeg"], rhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(6)), speedy) AnimateThing(char["RightLowerLeg"], rhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["RightFoot"], rhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperLeg"], lhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(-6)), speedy) AnimateThing(char["LeftLowerLeg"], lhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftFoot"], lhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["Head"], necknor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(95 + 5), Rad(0), Rad(0)), speedy) elseif floor ~= nil then AnimateThing(char["LowerTorso"], ltnor * CFrame.new(0, -3.76, 0) * CFrame.Angles(Rad(-95 + 5), Rad(0), Rad(0)), speedy/1.45) AnimateThing(char["UpperTorso"], utnor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperArm"], rsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(15), Rad(0)), speedy) AnimateThing(char["RightLowerArm"], rsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["RightHand"], rsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperArm"], lsnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(185), Rad(-15), Rad(0)), speedy) AnimateThing(char["LeftLowerArm"], lsnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(5), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftHand"], lsnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["RightUpperLeg"], rhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(6)), speedy) AnimateThing(char["RightLowerLeg"], rhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["RightFoot"], rhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftUpperLeg"], lhnor1 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-15), Rad(0), Rad(-6)), speedy) AnimateThing(char["LeftLowerLeg"], lhnor2 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(-7), Rad(0), Rad(0)), speedy) AnimateThing(char["LeftFoot"], lhnor3 * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(0), Rad(0), Rad(0)), speedy) AnimateThing(char["Head"], necknor * CFrame.new(0, 0, 0) * CFrame.Angles(Rad(95 + 5), Rad(0), Rad(0)), speedy) end end bv.Parent = root hum.PlatformStand = false attack = false diving = false Gyro:Destroy() end)() end end