Runner game collider

How to set collider for runner game’s main character?

Basically I was setting box or capsule type collider in game. This colliers work for you if you have only running and jumping action to perform.

But what if I have to perform sliding and hit action?? I have animation clip for this purpose then how can I attach colliders for those actions!!

Please if you have experience regarding this genre of game then give me some ideas. Thanks for giving me your time.

Are you concerned about the size and shape of the collider while performing various actions? These can all be animated, of course, so if your character’s profile changes shape, you can always change the collider’s shape too.

If the character won’t fit inside a primitive, then just use more than one collider to make the shape more complex (see Compound Colliders in the Rigidbody documentation). If you’re using 2D physics, you can use a polygon collider instead.

@Hyblademin Thanks for your reply. Basically primitive shape work for my main player.
Can you explain me I need to implement sliding for my main player?
Which kind of implementation I need to do for this?

For example, you can take this game as an example.
https://play.google.com/store/apps/details?id=com.medhaedu.krishnarun&hl=en

You have a few choices:

-You can add collider offset and size keys to your sliding animation. Animate the collider so that it continues to line up with your character as they enter a sliding pose, then again as they exit the sliding pose.

-You can modify the collider offset and size values directly in the script. If a primitive collider suits your character, this is probably the best choice for you. Simply change your Collider’s size and offset in your script at the same time as you change the character to a sliding pose/sprite, and change it back to the default values when they exit.

@Hyblademin I have one question, how to decide collider size if I am using animation controller for sprite animation of main player?

second question, how to adjust with collider in beat 'em up kind game? How to hit with leg and hand?
I just want some concept as like above game.

1: Just try a few values until you get some that look and feel right, it won’t take very long.

2: This would require multiple colliders. Depending on the attack, the colliders might need to be animated to keep them over the hands/feet.