New Bunny Hoppy Movement Code

Great code! Very well made.

However, one thing I noticed is that when you move in a diagonal (for example, pressing W and D at the same time) you move at twice the speed. Just wanted to let you know about this incase you’d be interested in fixing it.

To discover this, I used this code to show the player’s velocity:

local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
local label = Instance.new("TextLabel", gui)
label.Size = UDim2.new(0, 200, 0, 50)
label.BackgroundTransparency = 1
label.TextColor3 = Color3.new(1, 1, 1)
label.FontSize = Enum.FontSize.Size24
label.Font = Enum.Font.SourceSansBold
game:GetService("RunService").RenderStepped:Connect(function()
	local vel = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid") and game.Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid").RootPart.Velocity or Vector3.new()
	label.Text = "Speed: " .. math.floor((vel.X^2 + vel.Z^2)^0.5 + 0.5)
end)

It’s not great, but it can be used to showcase that your speed does in fact double when moving diagonally.

Thanks for this code!

This is actually intentional because the code is based off the movement in Quake, and in that game move diagonally makes you move faster.

If you don’t like it then in the GroundMove function calculate the wishSpeed variable after the wishDir is normalized (The wishDir = wishDir.Unit part).

Oh, okay. Makes sense, thanks!

Also, I noticed a crouch function. Though, it doesn’t seem to do anything. What’s that?

i can’t jump for some reason, is there a problem with the model or with my starter charactert?

Hey there! I’ve been using your code in a source-inspired engine i’ve been working on for a while now and was wondering if i could have permission to coninue using it. I can credit you up-front in an opening screen and other menus.

1 Like

Yeah of course you can use it. You don’t need to give me credits unless you really want to. I didn’t come up with all the math and physics for how the code works, just translated it from the source engine code to Roblox.

1 Like

It still seems to sometimes not let me move in studio and some people can never move in-game without jumping around. I have the game set to R6.

Make sure the script is in the right spot, and make sure none of your other scripts interfere with it, without more information I’m not sure how to help.

does all the parts in the map and the player still have to have 0 friction?

No, since I move the character using the Humanoid:Move() function instead of body movers, friction acts like it normally would.

do i actually have to worry about this??
image

yes line 170 doesnt have a end to close that if statement so your going to see errors

Any plans to add support for swimming?

How do i add surfing physics/mechanics?

That would require a custom physics engine which I am not smart enough to make. I actually tried to but couldn’t figure it out lol.

damn, then what about you use custom physical properties?, like making the player slide off of ramps

why whenever i press wasd alot fast my frames drop

or wait nvm it happens with every key

Will this ever be mobile/controller supported?

I don’t understand? Can anybody help me remove the diagonal moving feature? This comment doesn’t really help me understand how to change it as I am not that smart enough lo;. I want to make it more similar to Source and not Quake.