docs.unity3d.com
    Show / Hide Table of Contents

    Class KinematicCharacterUtilities

    Collection of utility functions for characters

    Inheritance
    Object
    KinematicCharacterUtilities
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.CharacterController
    Syntax
    public static class KinematicCharacterUtilities

    Methods

    AddVariableRateRotationFromFixedRateRotation(ref quaternion, quaternion, Single, Single)

    Incrementally rotates a rotation at a variable rate, based on a rotation delta that should happen over a fixed time delta

    Declaration
    public static void AddVariableRateRotationFromFixedRateRotation(ref quaternion modifiedRotation, quaternion fixedRateRotation, float deltaTime, float fixedDeltaTime)
    Parameters
    Type Name Description
    quaternion modifiedRotation

    The source rotation being modified

    quaternion fixedRateRotation

    The rotation that needs to happen over a fixed time delta

    Single deltaTime

    The variable time delta

    Single fixedDeltaTime

    The reference fixed time delta

    BakeCharacter<T>(Baker<T>, T, AuthoringKinematicCharacterProperties)

    Handles the conversion from GameObject to Entity for a character

    Declaration
    public static void BakeCharacter<T>(Baker<T> baker, T authoring, AuthoringKinematicCharacterProperties authoringProperties)
        where T : MonoBehaviour
    Parameters
    Type Name Description
    Baker<T> baker

    The baker that want to bake a character

    T authoring

    The monobehaviour used for authoring the character

    AuthoringKinematicCharacterProperties authoringProperties

    The properties of the character

    Type Parameters
    Name Description
    T

    The type of the monobehaviour used for authoring the character

    CreateCharacter(EntityCommandBuffer, Entity, AuthoringKinematicCharacterProperties)

    Adds all the required character components to an entity

    Declaration
    public static void CreateCharacter(EntityCommandBuffer commandBuffer, Entity entity, AuthoringKinematicCharacterProperties authoringProperties)
    Parameters
    Type Name Description
    EntityCommandBuffer commandBuffer

    The entity command buffer used to add components and buffers to the entity

    Entity entity

    The entity to create the character on

    AuthoringKinematicCharacterProperties authoringProperties

    The properties of the character

    CreateCharacter(EntityManager, Entity, AuthoringKinematicCharacterProperties)

    Adds all the required character components to an entity

    Declaration
    public static void CreateCharacter(EntityManager dstManager, Entity entity, AuthoringKinematicCharacterProperties authoringProperties)
    Parameters
    Type Name Description
    EntityManager dstManager

    The entity manager used for adding components and buffers

    Entity entity

    The entity to create the character on

    AuthoringKinematicCharacterProperties authoringProperties

    The properties of the character

    CreateCharacterHit(in BasicHit, Boolean, float3, Boolean)

    Creates a character hit buffer element based on the provided parameters

    Declaration
    public static KinematicCharacterHit CreateCharacterHit(in BasicHit newHit, bool characterIsGrounded, float3 characterRelativeVelocity, bool isGroundedOnHit)
    Parameters
    Type Name Description
    BasicHit newHit

    The detected hit

    Boolean characterIsGrounded

    Whether or not the character is currently grounded

    float3 characterRelativeVelocity

    The character's relative velocity

    Boolean isGroundedOnHit

    Whether or not the character would be grounded on this hit

    Returns
    Type Description
    KinematicCharacterHit

    The resulting character hit

    GetBaseCharacterQueryBuilder()

    Returns an entity query builder that includes all basic components of a character

    Declaration
    public static EntityQueryBuilder GetBaseCharacterQueryBuilder()
    Returns
    Type Description
    EntityQueryBuilder

    GetInterpolatedCharacterQueryBuilder()

    Returns an entity query builder that includes all basic components of a character as well as the interpolation component

    Declaration
    public static EntityQueryBuilder GetInterpolatedCharacterQueryBuilder()
    Returns
    Type Description
    EntityQueryBuilder

    SetCollisionDetectionActive(Boolean, ref KinematicCharacterProperties, ref PhysicsCollider)

    Sets various properties involved in making the character detect different forms of collisions. Warning: it is up to you to ensure that the collider passed as parameter to this function is unique, otherwise this will change the collision response for all characters that share this collider.

    Declaration
    public static void SetCollisionDetectionActive(bool active, ref KinematicCharacterProperties characterProperties, ref PhysicsCollider collider)
    Parameters
    Type Name Description
    Boolean active

    Whether or not collisions should be active

    KinematicCharacterProperties characterProperties

    The character properties component

    PhysicsCollider collider

    The character's collider component

    In This Article
    • Methods
      • AddVariableRateRotationFromFixedRateRotation(ref quaternion, quaternion, Single, Single)
      • BakeCharacter<T>(Baker<T>, T, AuthoringKinematicCharacterProperties)
      • CreateCharacter(EntityCommandBuffer, Entity, AuthoringKinematicCharacterProperties)
      • CreateCharacter(EntityManager, Entity, AuthoringKinematicCharacterProperties)
      • CreateCharacterHit(in BasicHit, Boolean, float3, Boolean)
      • GetBaseCharacterQueryBuilder()
      • GetInterpolatedCharacterQueryBuilder()
      • SetCollisionDetectionActive(Boolean, ref KinematicCharacterProperties, ref PhysicsCollider)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023