Skip to content

Locomotion

Patricio Guerra edited this page Jun 5, 2024 · 4 revisions

Summary

This section will provide you with an overview of how the Locomotion works.

Components and Dependencies

The current implementation of Locomotion is based on Unity's CharacterController component and Unity's Animation Rigging package for Inverse Kinematics.

Settings

All the Locomotion and IK settings are centralized at the CharacterControllerSettings scriptable object.

Features

The locomotion system features the following:

  • Input handling
  • Simple jump (tapping the jump button)
  • Long jump (long press jump button)
  • Coyote timer
  • Sprint and Walk
  • Stun (when falling from very high places)
  • Sliding from slopes
  • Stuck prevention from multiple slopes
  • Network replication
  • Platform movement
  • Emotes
  • Inverse Kinematics for:
    • Feet
    • Hands
    • Head

Plugin

The Locomotion is being initialized at CharacterMotionPlugin

All the systems are composed of running and jumping can be found at:

  • CalculateCharacterVelocitySystem
  • InterpolateCharacterSystem
  • RotateCharacterSystem
  • CharacterAnimationSystem

For other Locomotion-related systems, check out the folder: Assets/DCL/Character/Systems for all the systems involved in the character manipulation.

Setup

The locomotion movement and physics are being simulated by the Character Controller component in the CharacterObject prefab.

The Animator and IK setup is at the AvatarBase prefab

The CharacterAnimator asset contains the AnimatorController which has all the proper transitions, check the inner states for more information about the transitions.

image

⚠️ VERY IMPORTANT ⚠️

The AvatarBase prefab has the Armature of a DCL avatar, the scale of the Armature GameObject must be 0.01 and a rotation of 90 on the X-axis since the avatars are big and rotated.

Animation Clips

They are inside a folder in AvatarRendering/AvatarShape/Assets/Animations/

image

To avoid having GLB files in the project we extracted them as separate assets.

Clone this wiki locally