Struct KinematicCharacterAspect
Aspect regrouping the core components and logic of a character controller
Inherited Members
Namespace: Unity.CharacterController
Syntax
public readonly struct KinematicCharacterAspect : IAspect, IQueryTypeParameter
Fields
CharacterBody
The KinematicCharacterBody component of the character entity
Declaration
public readonly RefRW<KinematicCharacterBody> CharacterBody
Field Value
Type | Description |
---|---|
RefRW<KinematicCharacterBody> |
CharacterHitsBuffer
The KinematicCharacterHit dynamic buffer of the character entity
Declaration
public readonly DynamicBuffer<KinematicCharacterHit> CharacterHitsBuffer
Field Value
Type | Description |
---|---|
DynamicBuffer<KinematicCharacterHit> |
CharacterProperties
The KinematicCharacterProperties component of the character entity
Declaration
public readonly RefRW<KinematicCharacterProperties> CharacterProperties
Field Value
Type | Description |
---|---|
RefRW<KinematicCharacterProperties> |
DeferredImpulsesBuffer
The KinematicCharacterDeferredImpulse dynamic buffer of the character entity
Declaration
public readonly DynamicBuffer<KinematicCharacterDeferredImpulse> DeferredImpulsesBuffer
Field Value
Type | Description |
---|---|
DynamicBuffer<KinematicCharacterDeferredImpulse> |
Entity
The entity of the character
Declaration
public readonly Entity Entity
Field Value
Type | Description |
---|---|
Entity |
LocalTransform
The local transform component of the character entity
Declaration
public readonly RefRW<LocalTransform> LocalTransform
Field Value
Type | Description |
---|---|
RefRW<LocalTransform> |
PhysicsCollider
The PhysicsCollider component of the character entity
Declaration
public readonly RefRW<PhysicsCollider> PhysicsCollider
Field Value
Type | Description |
---|---|
RefRW<PhysicsCollider> |
StatefulHitsBuffer
The StatefulKinematicCharacterHit dynamic buffer of the character entity
Declaration
public readonly DynamicBuffer<StatefulKinematicCharacterHit> StatefulHitsBuffer
Field Value
Type | Description |
---|---|
DynamicBuffer<StatefulKinematicCharacterHit> |
VelocityProjectionHits
The KinematicVelocityProjectionHit dynamic buffer of the character entity
Declaration
public readonly DynamicBuffer<KinematicVelocityProjectionHit> VelocityProjectionHits
Field Value
Type | Description |
---|---|
DynamicBuffer<KinematicVelocityProjectionHit> |
Properties
Back
Returns the back direction of the character transform
Declaration
public readonly float3 Back { get; }
Property Value
Type | Description |
---|---|
float3 |
Down
Returns the down direction of the character transform
Declaration
public readonly float3 Down { get; }
Property Value
Type | Description |
---|---|
float3 |
Forward
Returns the forward direction of the character transform
Declaration
public readonly float3 Forward { get; }
Property Value
Type | Description |
---|---|
float3 |
Left
Returns the left direction of the character transform
Declaration
public readonly float3 Left { get; }
Property Value
Type | Description |
---|---|
float3 |
Right
Returns the right direction of the character transform
Declaration
public readonly float3 Right { get; }
Property Value
Type | Description |
---|---|
float3 |
Up
Returns the up direction of the character transform
Declaration
public readonly float3 Up { get; }
Property Value
Type | Description |
---|---|
float3 |
Methods
CalculateAngleOfHitWithGroundUp(float3, float3, float3, float3)
Determines the effective signed slope angle of a hit based on character movement direction (negative sign means downward)
Declaration
public readonly float CalculateAngleOfHitWithGroundUp(float3 currentGroundUp, float3 hitNormal, float3 velocityDirection, float3 groundingUp)
Parameters
Type | Name | Description |
---|---|---|
float3 | currentGroundUp | Current ground hit normal |
float3 | hitNormal | Evaluated hit normal |
float3 | velocityDirection | Direction of the character's velocity |
float3 | groundingUp | Grounding up of the character |
Returns
Type | Description |
---|---|
Single | The signed slope angle of the hit in the character's movement direction |
CalculateDistanceAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, quaternion, Single, Boolean, out NativeList<DistanceHit>)
Calculates distance from the character collider and only returns all collideable hits
Declaration
public readonly bool CalculateDistanceAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 characterPosition, quaternion characterRotation, float maxDistance, bool ignoreDynamicBodies, out NativeList<DistanceHit> hits)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | characterPosition | The position of the character |
quaternion | characterRotation | The rotation of the character |
Single | maxDistance | The direction of the case |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
NativeList<DistanceHit> | hits | The detected hits |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
CalculateDistanceClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, quaternion, Single, Boolean, out DistanceHit)
Calculates distance from the character collider and only returns the closest collideable hit
Declaration
public readonly bool CalculateDistanceClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 characterPosition, quaternion characterRotation, float maxDistance, bool ignoreDynamicBodies, out DistanceHit hit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | characterPosition | The position of the character |
quaternion | characterRotation | The rotation of the character |
Single | maxDistance | The direction of the case |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
DistanceHit | hit | The closest detected hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
CastColliderAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, quaternion, float3, Single, Boolean, Boolean, out NativeList<ColliderCastHit>)
Casts the character collider and returns all collideable hit
Declaration
public readonly bool CastColliderAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 characterPosition, quaternion characterRotation, float3 direction, float length, bool onlyObstructingHits, bool ignoreDynamicBodies, out NativeList<ColliderCastHit> hits)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | characterPosition | The position of the character |
quaternion | characterRotation | The rotation of the character |
float3 | direction | The direction of the case |
Single | length | The length of the cast |
Boolean | onlyObstructingHits | Should the cast only detect hits whose normal is opposed to the direction of the cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
NativeList<ColliderCastHit> | hits | All valid detected hits |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
CastColliderClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, quaternion, float3, Single, Boolean, Boolean, out ColliderCastHit, out Single)
Casts the character collider and only returns the closest collideable hit
Declaration
public readonly bool CastColliderClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 characterPosition, quaternion characterRotation, float3 direction, float length, bool onlyObstructingHits, bool ignoreDynamicBodies, out ColliderCastHit hit, out float hitDistance)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | characterPosition | The position of the character |
quaternion | characterRotation | The rotation of the character |
float3 | direction | The direction of the case |
Single | length | The length of the cast |
Boolean | onlyObstructingHits | Should the cast only detect hits whose normal is opposed to the direction of the cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
ColliderCastHit | hit | The closest detected hit |
Single | hitDistance | The distance of the closest detected hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
CheckForSteppingUpHit<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, ref KinematicCharacterHit, ref float3, ref Single, Single, Boolean, Single, Single, out Boolean)
Handles the stepping-up-a-step logic during character movement iterations
Declaration
public readonly void CheckForSteppingUpHit<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, ref KinematicCharacterHit hit, ref float3 remainingMovementDirection, ref float remainingMovementLength, float hitDistance, bool stepHandling, float maxStepHeight, float characterWidthForStepGroundingCheck, out bool hasSteppedUp)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
KinematicCharacterHit | hit | The hit to decollide from |
float3 | remainingMovementDirection | |
Single | remainingMovementLength | |
Single | hitDistance | |
Boolean | stepHandling | |
Single | maxStepHeight | |
Single | characterWidthForStepGroundingCheck | Character width used to determine grounding for steps. This is for cases where character with a spherical base tries to step onto an angled surface that is near the character's max step height. In thoses cases, the character might be grounded on steps on one frame, but wouldn't be grounded on the next frame as the spherical nature of its shape would push it a bit further up beyond its max step height. |
Boolean | hasSteppedUp |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
DecollideFromHit<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, in BasicHit, Single, float3, Boolean, Boolean, Boolean, Boolean, Boolean)
Decollides character from a specific hit
Declaration
public readonly void DecollideFromHit<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, in BasicHit hit, float decollisionDistance, float3 originalVelocityDirection, bool characterSimulateDynamic, bool isGroundedOnHit, bool hitIsDynamic, bool addToCharacterHits, bool projectVelocityOnHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
BasicHit | hit | The hit to decollide from |
Single | decollisionDistance | |
float3 | originalVelocityDirection | Direction of the character velocity before any projection of velocity happened on this update |
Boolean | characterSimulateDynamic | |
Boolean | isGroundedOnHit | |
Boolean | hitIsDynamic | |
Boolean | addToCharacterHits | |
Boolean | projectVelocityOnHit |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Default_IsGroundedOnHit<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, in BasicHit, in BasicStepAndSlopeHandlingParameters, Int32)
Default implementation of the "IsGroundedOnHit" processor callback. Calls default grounding evaluation for a hit
Declaration
public readonly bool Default_IsGroundedOnHit<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, in BasicHit hit, in BasicStepAndSlopeHandlingParameters stepAndSlopeHandling, int groundingEvaluationType)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
BasicHit | hit | The hit to decollide from |
BasicStepAndSlopeHandlingParameters | stepAndSlopeHandling | Whether or not step-handling is enabled |
Int32 | groundingEvaluationType | Identifier for the type of grounding evaluation that's being requested |
Returns
Type | Description |
---|---|
Boolean | Whether or not the character is grounded on the hit |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Default_OnMovementHit<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, ref KinematicCharacterHit, ref float3, ref Single, float3, Single, Boolean, Single, Single)
Default implementation of the "OnMovementHit" processor callback
Declaration
public readonly void Default_OnMovementHit<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, ref KinematicCharacterHit hit, ref float3 remainingMovementDirection, ref float remainingMovementLength, float3 originalVelocityDirection, float movementHitDistance, bool stepHandling, float maxStepHeight, float characterWidthForStepGroundingCheck = 0F)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
KinematicCharacterHit | hit | The hit to decollide from |
float3 | remainingMovementDirection | Direction of the character movement that's left to be processed |
Single | remainingMovementLength | Magnitude of the character movement that's left to be processed |
float3 | originalVelocityDirection | Original character velocity direction before any projection happened |
Single | movementHitDistance | Distance of the hit |
Boolean | stepHandling | Whether step-handling is enabled or not |
Single | maxStepHeight | Maximum height of steps that can be stepped on |
Single | characterWidthForStepGroundingCheck | Character width used to determine grounding for steps. This is for cases where character with a spherical base tries to step onto an angled surface that is near the character's max step height. In thoses cases, the character might be grounded on steps on one frame, but wouldn't be grounded on the next frame as the spherical nature of its shape would push it a bit further up beyond its max step height. |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Default_ProjectVelocityOnHits(ref float3, ref Boolean, ref BasicHit, in DynamicBuffer<KinematicVelocityProjectionHit>, float3, Boolean)
Default implementation of the "ProjectVelocityOnHits" processor callback. Projects velocity based on grounding considerations
Declaration
public readonly void Default_ProjectVelocityOnHits(ref float3 velocity, ref bool characterIsGrounded, ref BasicHit characterGroundHit, in DynamicBuffer<KinematicVelocityProjectionHit> velocityProjectionHits, float3 originalVelocityDirection, bool constrainToGoundPlane)
Parameters
Type | Name | Description |
---|---|---|
float3 | velocity | Character velocity |
Boolean | characterIsGrounded | Whether character is grounded or not |
BasicHit | characterGroundHit | The ground hit of the character |
DynamicBuffer<KinematicVelocityProjectionHit> | velocityProjectionHits | List of hits that the velocity must be projected on, from oldest to most recent |
float3 | originalVelocityDirection | Original character velocity direction before any projection happened |
Boolean | constrainToGoundPlane | Whether or not to constrain |
Default_UpdateGroundingUp(ref KinematicCharacterBody)
Default implementation of the "UpdateGroundingUp" processor callback. Sets the character ground up to the character transform's up direction
Declaration
public readonly void Default_UpdateGroundingUp(ref KinematicCharacterBody characterBody)
Parameters
Type | Name | Description |
---|---|---|
KinematicCharacterBody | characterBody | The character body component |
DetectFutureSlopeChange<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, Single, Single, Single, Single, Boolean, Single, out Boolean, out Boolean, out Single, out RaycastHit)
Detects how the ground slope will change over the next character update, based on current character velocity
Declaration
public readonly void DetectFutureSlopeChange<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float verticalOffset, float downDetectionDepth, float deltaTimeIntoFuture, float secondaryNoGroundingCheckDistance, bool stepHandling, float maxStepHeight, out bool isMovingTowardsNoGrounding, out bool foundSlopeHit, out float futureSlopeChangeAnglesRadians, out RaycastHit futureSlopeHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
Single | verticalOffset | Vertical upwards distance where detection raycasts will begin |
Single | downDetectionDepth | Distance of downwards slope detection raycasts |
Single | deltaTimeIntoFuture | Time delta into future to detect slopes at with the current character velocity |
Single | secondaryNoGroundingCheckDistance | Extra horizontal raycast distance for a secondary slope detection raycast |
Boolean | stepHandling | Whether step-handling is enabled or not |
Single | maxStepHeight | Maximum height of steps that can be stepped on |
Boolean | isMovingTowardsNoGrounding | Whether or not the character is moving towards a place where it wouldn't be grounded |
Boolean | foundSlopeHit | Whether or not we found a slope hit in the future |
Single | futureSlopeChangeAnglesRadians | The detected slope angle change (in radians) in the future |
RaycastHit | futureSlopeHit | The detected slope hit in the future |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterColliderCastHitsForAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<ColliderCastHit>, Boolean, float3, Boolean)
Filters a list of hits and keeps only valid hits
Declaration
public readonly bool FilterColliderCastHitsForAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<ColliderCastHit> hits, bool onlyObstructingHits, float3 castDirection, bool ignoreDynamicBodies)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<ColliderCastHit> | hits | The list of hits to filter |
Boolean | onlyObstructingHits | Should the cast only detect hits whose normal is opposed to the direction of the cast |
float3 | castDirection | The direction of the ground probing cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterColliderCastHitsForClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<ColliderCastHit>, Boolean, float3, Boolean, out ColliderCastHit)
Filters a list of hits and returns the closest valid hit
Declaration
public readonly bool FilterColliderCastHitsForClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<ColliderCastHit> hits, bool onlyObstructingHits, float3 castDirection, bool ignoreDynamicBodies, out ColliderCastHit closestHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<ColliderCastHit> | hits | The list of hits to filter |
Boolean | onlyObstructingHits | Should the cast only detect hits whose normal is opposed to the direction of the cast |
float3 | castDirection | The direction of the ground probing cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
ColliderCastHit | closestHit | The closest detected hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterColliderCastHitsForGroundProbing<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<ColliderCastHit>, float3, Boolean, out ColliderCastHit)
Filters a list of hits for ground probing and returns the closest valid hit
Declaration
public readonly bool FilterColliderCastHitsForGroundProbing<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<ColliderCastHit> hits, float3 castDirection, bool ignoreDynamicBodies, out ColliderCastHit closestHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<ColliderCastHit> | hits | The list of hits to filter |
float3 | castDirection | The direction of the ground probing cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
ColliderCastHit | closestHit | The closest detected hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterColliderCastHitsForMove<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<ColliderCastHit>, Boolean, float3, Entity, Boolean, out ColliderCastHit, out Boolean)
Filters a list of hits for character movement and returns the closest valid hit
Declaration
public readonly bool FilterColliderCastHitsForMove<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<ColliderCastHit> hits, bool characterIsKinematic, float3 castDirection, Entity ignoredEntity, bool ignoreDynamicBodies, out ColliderCastHit closestHit, out bool foundAnyOverlaps)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<ColliderCastHit> | hits | The list of hits to filter |
Boolean | characterIsKinematic | Is the character kinematic (as opposed to simulated dynamic) |
float3 | castDirection | The direction of the ground probing cast |
Entity | ignoredEntity | An optional Entity to force ignore |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
ColliderCastHit | closestHit | The closest detected hit |
Boolean | foundAnyOverlaps | Whether any overlaps were found with other colliders |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterDistanceHitsForAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<DistanceHit>, Boolean)
Filters a list of hits and returns all valid hits
Declaration
public readonly bool FilterDistanceHitsForAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<DistanceHit> hits, bool ignoreDynamicBodies)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<DistanceHit> | hits | The list of hits to filter |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterDistanceHitsForClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<DistanceHit>, Boolean, out DistanceHit)
Filters a list of hits and returns the closest valid hit
Declaration
public readonly bool FilterDistanceHitsForClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<DistanceHit> hits, bool ignoreDynamicBodies, out DistanceHit closestHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<DistanceHit> | hits | The list of hits to filter |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
DistanceHit | closestHit | The closest valid hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterDistanceHitsForSolveOverlaps<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<DistanceHit>, out DistanceHit, out DistanceHit, out DistanceHit)
Filters a list of hits for overlap resolution, and keeps only valid hits. Also returns a variety of closest hits
Declaration
public readonly void FilterDistanceHitsForSolveOverlaps<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<DistanceHit> hits, out DistanceHit closestHit, out DistanceHit closestDynamicHit, out DistanceHit closestNonDynamicHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<DistanceHit> | hits | The list of hits to filter |
DistanceHit | closestHit | The closest valid hit |
DistanceHit | closestDynamicHit | The closest valid dynamic hit |
DistanceHit | closestNonDynamicHit | The closest valid non-dynamic hit |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterRaycastHitsForAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<RaycastHit>, Boolean)
Filters a list of hits and returns all valid hits
Declaration
public readonly bool FilterRaycastHitsForAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<RaycastHit> hits, bool ignoreDynamicBodies)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<RaycastHit> | hits | The list of hits to filter |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
FilterRaycastHitsForClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref NativeList<RaycastHit>, Boolean, out RaycastHit)
Filters a list of hits and returns the closest valid hit
Declaration
public readonly bool FilterRaycastHitsForClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref NativeList<RaycastHit> hits, bool ignoreDynamicBodies, out RaycastHit closestHit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
NativeList<RaycastHit> | hits | The list of hits to filter |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
RaycastHit | closestHit | The closest valid hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit remains |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
GroundDetection<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, Single, out Boolean, out BasicHit, out Single)
Detects grounding at the current character pose
Declaration
public readonly void GroundDetection<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float groundProbingLength, out bool isGrounded, out BasicHit groundHit, out float distanceToGround)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
Single | groundProbingLength | Ground probing collider cast distance |
Boolean | isGrounded | Outputs whether or not valid ground was detected |
BasicHit | groundHit | Outputs the detected ground hit |
Single | distanceToGround | Outputs the distance of the detected ground hit |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
IsGroundedOnSlopeNormal(Single, float3, float3)
Determines if the slope angle is within grounded tolerance
Declaration
public readonly bool IsGroundedOnSlopeNormal(float maxGroundedSlopeDotProduct, float3 slopeSurfaceNormal, float3 groundingUp)
Parameters
Type | Name | Description |
---|---|---|
Single | maxGroundedSlopeDotProduct | Dot product between grounding up and maximum slope normal direction |
float3 | slopeSurfaceNormal | Evaluated slope normal |
float3 | groundingUp | Character's grounding up |
Returns
Type | Description |
---|---|
Boolean | Whether or not the character can be grounded on this slope |
IsGroundedOnSteps<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, in BasicHit, Single, Single)
Determines if step-handling considerations would make a character be grounded on a hit
Declaration
public readonly bool IsGroundedOnSteps<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, in BasicHit hit, float maxStepHeight, float extraStepChecksDistance)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
BasicHit | hit | The hit to decollide from |
Single | maxStepHeight | The maximum height that the character can step over |
Single | extraStepChecksDistance | The horizontal distance at which extra downward step-detection raycasts will be made, in order to allow stepping over steps that are slightly angled |
Returns
Type | Description |
---|---|
Boolean | Whether or not step-handling would make the character grounded on this hit |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
MovementWouldHitNonGroundedObstruction<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, out ColliderCastHit)
Determines if the character movement collision detection would detect non-grounded obstructions with the designated movement vector
Declaration
public readonly bool MovementWouldHitNonGroundedObstruction<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 movement, out ColliderCastHit hit)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | movement | The movement vector of the character |
ColliderCastHit | hit | The hit to decollide from |
Returns
Type | Description |
---|---|
Boolean | Whether or not a non-grounded obstruction would be hit with the designated movement |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
MoveWithCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, float3, out Boolean)
Handles casting the character shape in the velocity direction/magnitude order to detect hits, projecting the character velocity on those hits, and moving the character. The process is repeated until no new hits are detected, or until a certain max amount of iterations is reached.
Declaration
public readonly void MoveWithCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, float3 originalVelocityDirection, out bool confirmedNoOverlapsOnLastMoveIteration)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
float3 | originalVelocityDirection | Direction of the character velocity before any projection of velocity happened on this update |
Boolean | confirmedNoOverlapsOnLastMoveIteration | Whether or not we can confirm that the character wasn't overlapping with any colliders after the last movement iteration. This is used for optimisation purposes as it gives us an opportunity to skip certain physics queries later in the character update |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
ProcessCharacterHitDynamics<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody)
Handles calculating forces resulting from character hits, and these forces may be applied both to the character or to the hit body.
Declaration
public readonly void ProcessCharacterHitDynamics<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
ProjectVelocityOnGrounding(ref float3, float3, float3)
Handles the special case of projecting character velocity on a grounded hit, where the velocity magnitude is multiplied by a factor of 1 when it is parallel to the ground, and a factor of 0 when it is parallel to the character's "grounding up direction".
Declaration
public readonly void ProjectVelocityOnGrounding(ref float3 velocity, float3 groundNormal, float3 groundingUp)
Parameters
Type | Name | Description |
---|---|---|
float3 | velocity | The velocity to project |
float3 | groundNormal | The detected ground normal |
float3 | groundingUp | The grounding up direction of the character |
RaycastAllCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, float3, Single, Boolean, out NativeList<RaycastHit>)
Casts a ray and returns all collideable hits
Declaration
public readonly bool RaycastAllCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 startPoint, float3 direction, float length, bool ignoreDynamicBodies, out NativeList<RaycastHit> hits)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | startPoint | The cast start point |
float3 | direction | The direction of the case |
Single | length | The length of the cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
NativeList<RaycastHit> | hits | The detected hits |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
RaycastClosestCollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, float3, Single, Boolean, out RaycastHit, out Single)
Casts a ray and only returns the closest collideable hit
Declaration
public readonly bool RaycastClosestCollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 startPoint, float3 direction, float length, bool ignoreDynamicBodies, out RaycastHit hit, out float hitDistance)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | startPoint | The cast start point |
float3 | direction | The direction of the case |
Single | length | The length of the cast |
Boolean | ignoreDynamicBodies | Should the cast ignore dynamic bodies |
RaycastHit | hit | The detected hit |
Single | hitDistance | The distance of the detected hit |
Returns
Type | Description |
---|---|
Boolean | Whether or not any valid hit was detected |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
SetOrUpdateParentBody(ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, Entity, float3)
Called on every character physics update in order to set a parent body for the character
Declaration
public readonly void SetOrUpdateParentBody(ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, Entity parentEntity, float3 anchorPointLocalParentSpace)
Parameters
Type | Name | Description |
---|---|---|
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
Entity | parentEntity | The parent entity of the character |
float3 | anchorPointLocalParentSpace | The contact point between character and parent, in the parent's local space, around which the character will be rotated |
ShouldPreventGroundingBasedOnVelocity(in PhysicsWorld, in BasicHit, Boolean, float3)
Determines if grounded status should be prevented, based on the velocity of the character as well as the velocity of the hit body, if any.
Declaration
public readonly bool ShouldPreventGroundingBasedOnVelocity(in PhysicsWorld physicsWorld, in BasicHit hit, bool wasGroundedBeforeCharacterUpdate, float3 relativeVelocity)
Parameters
Type | Name | Description |
---|---|---|
PhysicsWorld | physicsWorld | The physics world in which the hit body exists |
BasicHit | hit | The hit to evaluate |
Boolean | wasGroundedBeforeCharacterUpdate | Whether or not the character was grounded at the start of its update, before ground detection |
float3 | relativeVelocity | The relative velocity of the character |
Returns
Type | Description |
---|---|
Boolean | Whether or not grounding should be set to false |
SolveOverlaps<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, float3)
Handles detecting current overlap hits, and decolliding the character from them
Declaration
public readonly void SolveOverlaps<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, float3 originalVelocityDirection)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
float3 | originalVelocityDirection | Direction of the character velocity before any projection of velocity happened on this update |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_Grounding<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3)
Handles detecting character grounding and storing results in KinematicCharacterBody
Declaration
public readonly void Update_Grounding<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_GroundPushing<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, float3, Single)
Handles applying ground push forces to the currently-detected ground hit, if applicable
Declaration
public readonly void Update_GroundPushing<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, float3 gravity, float forceMultiplier = 1F)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
float3 | gravity | The effective gravity used to create a force to apply to the ground, in combination with the character mass |
Single | forceMultiplier | An arbitrary multiplier to apply to the calculated force to apply to the ground |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_Initialize<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, Single)
The initialization step of the character update (should be called on every character update). This resets key component values and buffers
Declaration
public readonly void Update_Initialize<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, float deltaTime)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
Single | deltaTime | The time delta of the character update |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_MovementAndDecollisions<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3)
Handles moving the character and solving collisions, based on character velocity, rotation, character grounding, and various other properties
Declaration
public readonly void Update_MovementAndDecollisions<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_MovingPlatformDetection(ref KinematicCharacterUpdateContext, ref KinematicCharacterBody)
Handles detecting valid moving platforms based on current ground hit, and automatically sets them as the character's parent entity
Declaration
public readonly void Update_MovingPlatformDetection(ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody)
Parameters
Type | Name | Description |
---|---|---|
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
Update_ParentMomentum(ref KinematicCharacterUpdateContext, ref KinematicCharacterBody)
Handles preserving velocity momentum when getting unparented from a parent body (such as a moving platform).
Declaration
public readonly void Update_ParentMomentum(ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody)
Parameters
Type | Name | Description |
---|---|---|
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
Update_ParentMovement<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, ref float3, Boolean)
Handles moving the character based on its currently-assigned ParentEntity, if any.
Declaration
public readonly void Update_ParentMovement<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, ref float3 characterPosition, bool constrainRotationToGroundingUp)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
float3 | characterPosition | The position of the character |
Boolean | constrainRotationToGroundingUp | Whether or not to limit rotation around the grounding up direction |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_PreventGroundingFromFutureSlopeChange<T, C>(in T, ref C, ref KinematicCharacterUpdateContext, ref KinematicCharacterBody, in BasicStepAndSlopeHandlingParameters, Single, Single, Single)
Handles predicting future slope changes in order to prevent grounding in certain scenarios
Declaration
public readonly void Update_PreventGroundingFromFutureSlopeChange<T, C>(in T processor, ref C context, ref KinematicCharacterUpdateContext baseContext, ref KinematicCharacterBody characterBody, in BasicStepAndSlopeHandlingParameters stepAndSlopeHandling, float slopeDetectionVerticalOffset = 0.05F, float slopeDetectionDownDetectionDepth = 0.05F, float slopeDetectionSecondaryNoGroundingCheckDistance = 0.25F)
where T : struct, IKinematicCharacterProcessor<C> where C : struct
Parameters
Type | Name | Description |
---|---|---|
T | processor | The struct implementing IKinematicCharacterProcessor<C> |
C | context | The user context struct holding global data meant to be accessed during the character update |
KinematicCharacterUpdateContext | baseContext | The built-in context struct holding global data meant to be accessed during the character update |
KinematicCharacterBody | characterBody | The character body component |
BasicStepAndSlopeHandlingParameters | stepAndSlopeHandling | Parameters for step and slope handling |
Single | slopeDetectionVerticalOffset | The vertical distance from ground hit at which slope detection raycasts will start |
Single | slopeDetectionDownDetectionDepth | The distance of downward slope detection raycasts, added to the initial vertical offset |
Single | slopeDetectionSecondaryNoGroundingCheckDistance | The forward distance of an extra raycast meant to detect slopes that are slightly further away than where our velocity would bring us over the next update |
Type Parameters
Name | Description |
---|---|
T | The type of the struct implementing IKinematicCharacterProcessor<C> |
C | The type of the user-created context struct |
Update_ProcessStatefulCharacterHits()
Handles filling the stateful hits buffer on the character entity, with character hits that have an Enter/Exit/Stay state associated to them
Declaration
public readonly void Update_ProcessStatefulCharacterHits()