Transition from a dive into a roll

I’m trying to make a dive and roll system inspired by RB Battles’ game (shown in the video below)


But, I don’t really have a clear logic of how to initiate the roll itself. Should I use a timer, a state system, touch based event, and such.

Here’s what I have so far, it’s just a basic dive system using velocity and rotvelocity to move the root


I really need help with this, so any type of help is heavily appreciated, thanks!

RB Battles seem to be using animation for the dive and roll, roll animation plays when player lands
And instead of applying linear velocity to dive forward, apply force

1 Like

What’s the optimal way to detect if the player has touched the ground?

You could either listen for a signal of the humanoids StateChanged event, or get the property changed signal of its FloorMaterial. (Checking for the floor material is better imo, because it fires even if you touch a wall, and you dont have to handle deleting the listener when the rolling is done)

local connection : RBXScriptConnection = humanoid.StateChanged:Connect(function(oldState: HumanoidStateType, newState : HumanoidStateType)
     if newState == Enum.HumanoidStateType.Landed then -- 
          -- Initiate rolling animation
          connection:Disconnect()
     end
end)

OR

humanoid:GetPropertyChangedSignal("FloorMaterial"):Once(function()
     -- Initiate rolling animation
end)

I havent tested neither, but im pretty sure both of these work, so use whichever works best for you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.