Character - Supporting Slopes without Rotating

If you are creating a game in a retro-style you may want to support slopes without rotation. This approach uses the colliders to push the character upwards when they intersect with a slope, so the character will always stand on top of the slope.

When moving down a slope this approach requires a movement which supports Snap to Ground. Snap to ground support means the movement will automatically move the character down to ensure its feet are aligned with the ground.

At the time of writing the following movements support Snap to Ground:

  • Digital
  • Digital with Run
  • Physics (optional setting)

In order for this to work on steep angles you need to ensure your Characters Grounded Look Ahead (set in Character - Advanced Settings) is large enough to always detect the ground. You can calculate this using the equation:

sin(maxGroundAngle) * maxSpeed * maxFrameTime = grounded look ahead

For example if your character moves at a max speed of 8 units per second and you want to support 30 degree angles you need a lookahead of (assuming the default max frame time of 0.033): 

0.5 * 8 * 0.033 = 0.132

 

You can see this setup in action in the scene: SampleScene-Alien-Level1.1

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk