Hello, I am new to game development and C# scripting. With my friend, we want to create a mobile game similar as Subway Surfers. We have three lines of movement, jump and roll. We use Character Controller for our movement and it works fine with moving into other lanes and jumping, but we are stuck with rolling. We already have animation for rolling when we swipe down on the device, but we don’t know how to alter Character Controller, so it would follow the animation and it could overcome some obstacles.
Thanks in advance for any kind of advice, we would be really grateful.
I don’t think you’ll have any success rolling a CharacterController.
Your best be is probably to put your visible geometry as a child to the CC and roll the visible geometry, probably best with either a canned “roll” animation, or else use a tweening package like DOTWeen or ITween or Leantween , unless you wanna try and hand-roll the code yourself.
You could probably play the animation, but lower the character controllers hitbox to the player, and the raise it back up when he’s done rolling.
Have you tried using root motion? I’m pretty sure you can turn it on and off in script, so maybe you could turn-off root motion for the roll and then turn if off again after the roll.