This page is a work in progress and could be pending updates.

Overview

Level Advanced

Overview

A Kinematic Character Controller (KCC for short) enables character movement based on constraints (e.g. collisions) without a rigidbody. Although the KCC is not affected by physics forces, it will carry out the movement while being constrained by collisions.

The Advanced KCC Addon for Fusion is a generic and relatively low-level character controller solution that is not specific to any game type. It is meant to cleanly integrate with any Fusion project with as little friction or bloat as possible.

Back To Top

How-To

To use the KCC follow these steps:

  1. Create prefab variant of Prefabs/KCC.prefab or create a new object and add KCC component
  2. Set desired settings (radius, height, ...)
  3. Link KCC processors in Settings/Processors (default ground/air processors are available in Prefabs folder)
  4. Use KCC public API to set input properties

Any object which provides an interaction to KCC must have NetworkObject component.

N.B.: Before getting deeper into KCC internals, please check KCC Sample project (separate package) - it has fully documented code and testing playground.

Back To Top

Download

Version Release Date Download
1.1.5 Jun 29, 2022 Fusion KCC 1.1.5 Build 53

Back To Top

Features Summary

  • Full control over position and look rotation (pitch + yaw).
  • Physics query and depenetration for capsule collider.
  • Interpolated render for networked proxies, extrapolated render with full simulation for objects with input or state authority.
  • Combined dynamic (physics-like) and kinematic (unrealistic) velocity based movement.
  • Support for unconstrained external forces - acceleration, velocity, force, impulse.
  • Base implementation for Ground and Air with configurable kinematic acceleration and friction models (both can be treated as advanced example).
  • Pipeline with "stages" and "processors". In each stage, KCC processors calculate different properties (tangent, speed, velocity, ...) which are then used in following stages / physics query / post-calculations.
  • Processors can be be used directly as prefabs (shareable, must be stateless) or scene objects (can be stateful with networked properties).
  • Embedded support for 2 types of interaction - manually registered ("KCC Modifier") and collision based ("KCC Collision"). Interactions are default way to inject processors into movement calculation pipeline.
  • Support for processors priority (execution order) and suppression - this allows absolute, additive, multiplicative or hybrid calculations of properties in processors chain.
  • Basic setup for synchronizing networked properties (radius, height, mass, ...), optional synchronization of other properties.
  • Custom Collider filtering callback, ignoring child colliders.
  • Custom Collider ignore list (networked).
  • Continuous collision detection.
  • Collision enter/exit callbacks for authority.
  • Separate game object for KCC collider - child object created at runtime.
  • Support for terrain collider.
  • Support for ground snapping and step height.
  • Automatic / Manual execution of update methods, support for local non-networked KCC.
  • Extensible data structures.
  • Pooling compatible.
  • Network & performance optimized.
  • Platform independent, mobile friendly.
  • Fully commented example with testing playground (separate package).
  • Basic support for frame by frame debug - editor drawings and logging.

Back To Top

Main Pros And Cons Of Extrapolated Movement

Pros:

  • Immediate response to input.
  • Visually almost invariant to network conditions.

Cons:

  • Extra CPU pressure for simulation in render frames.
  • Delta time based accumulations in render updates might be inconsistent with fixed updates due to variable delta time.
  • Needs extrapolation error correction.

Back To Top

Updating The Addon

The recommended way is delete KCC root folder (Assets > Photon > FusionAddons > KCC) before importing a new KCC package. In most cases the KCC is forward compatible with newer versions of the Fusion SDK.

If problems occur when updating to a newer Fusion SDK (compile errors, broken behavior, ...), please contact the nearest Photonian.

Back To Top

Extending

KCC and its data structures are prepared for extensions through partial implementation. This allows you to write custom functionality, extend public API and have access to private data for further processing (be careful) without touching our files. It also makes the update process much easier and conflicts-free.

Partial implementation can be used on these classes:

  • KCC - extending API, networked properties setup through InitializeUserNetworkProperties()
  • KCCData - adding custom rollback-able properties for use in processors (and movement update in general)
  • KCCSettings - adding custom settings
  • KCCInteraction - adding custom getters for further filtering or extracting data from all interactions
  • KCCCollision - adding custom getters for further filtering or extracting data from collisions
  • KCCModifier - adding custom getters for further filtering or extracting data from modifiers
  • All KCC extensions and utility classes

For more details and extension examples, please see KCC Sample project (separate package).

Back To Top

Dynamic Vs. Kinematic Velocity

Dynamic velocity is designed to mimic physics-like behavior and is primarily driven by forces. The KCC provides a single stage to calculate it. Kinematic velocity on the other hand is designed to cover all other movement velocities and provides more stages (4) to mix any kind of unrealistic movement.

The resulting desired velocity is the sum of dynamic and kinematic velocity.

Back To Top

Known Issues

  • Depenetration algorithm sometimes fails when colliding with multiple colliders (especially concave mesh colliders), causing minor jitter.
  • Step detection is currently based on raycast, which doesn't provide enough quality. This will be fixed with shape overlaps.


To Document Top