Execution Order
Overview
The execution order of the KCC's internal logic is important to take into account when extending it.
Simplified Execution Order
- KCC.SetInputDirection(): called from a player controller code before KCC internal update.
- KCC.SetLookRotation(): called from a player controller code before KCC internal update
- Another KCC API calls setting "input" properties
- KCC internal update
- Pre-caching KCC processors
- IKCCProcessor.SetInputProperties(): Dedicated stage to set input properties (ground angle, base position, gravity, ...).
- IKCCProcessor.SetDynamicVelocity():Dedicated stage to calculate KCCData.DynamicVelocity.
- IKCCProcessor.SetKinematicDirection(): Dedicated stage to calculate KCCData.KinematicDirection.
- IKCCProcessor.SetKinematicTangent(): Dedicated stage to calculate KCCData.KinematicTangent.
- IKCCProcessor.SetKinematicSpeed(): Dedicated stage to calculate KCCData.KinematicSpeed.
- IKCCProcessor.SetKinematicVelocity(): Dedicated stage to calculate KCCData.KinematicVelocity (combining Kinematic properties calculated in previous stages).
- Movement with calculated velocities. This step can be executed multiple times in a row if the desired velocity is too big (CCD is applied).
- Physics query.
- IKCCProcessor.ProcessPhysicsQuery(): Dedicated stage to calculate properties after single physics query (for example kinematic velocity ground projection).
- Collision update: IKCCProcessor.Enter()&IKCCProcessor.Exit()callbacks.
 
- IKCCProcessor.Stay(): Dedicated stage to execute custom processor logic.
- Transform synchronization.
 
For more info about processors and their stages, please check commented code and KCC sample project.
Back to top