Character Controller Pro
1.3.8
A 2D/3D character controller asset for the Unity Engine.
|
This class represents a character actor. It contains all the character information, collision flags, collision events, and so on. It also responsible for the execution order of everything related to the character, such as movement, rotation, teleportation, rigidbodies interactions, body size, etc. Since the character can be 2D or 3D, this abstract class must be implemented in the two formats, one for 2D and one for 3D. More...
Public Types | |
enum | CharacterVelocityMode { UseInputVelocity, UsePreSimulationVelocity, UsePostSimulationVelocity } |
enum | SizeReferenceType { Top, Center, Bottom } |
Public Types inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
enum | RootMotionVelocityType { RootMotionVelocityType.SetVelocity, RootMotionVelocityType.SetPlanarVelocity, RootMotionVelocityType.SetVerticalVelocity } |
Defines how the root velocity data is going to be applied to the actor. More... | |
enum | RootMotionRotationType { RootMotionRotationType.SetRotation, RootMotionRotationType.AddRotation } |
Defines how the root rotation data is going to be applied to the actor. More... | |
Public Member Functions | |
void | OnValidate () |
void | SetUpRootMotion (bool updateRootPosition=true, bool updateRootRotation=true) |
Sets up root motion for this actor. More... | |
void | SetUpRootMotion (bool updateRootPosition=true, RootMotionVelocityType rootMotionVelocityType=RootMotionVelocityType.SetVelocity, bool updateRootRotation=true, RootMotionRotationType rootMotionRotationType=RootMotionRotationType.AddRotation) |
Sets up root motion for this actor. More... | |
Vector3 | GetGroundPointVelocity (Vector3 position) |
Returns the point velocity (Rigidbody API) of the ground at a given position. More... | |
override string | ToString () |
Returns a concatenated string containing all the current collision information. More... | |
Vector3 | GetCenter (Vector3 position) |
Gets the center of the collision shape. More... | |
Vector3 | GetTop (Vector3 position) |
Gets the top most point of the collision shape. More... | |
Vector3 | GetBottom (Vector3 position) |
Gets the bottom most point of the collision shape. More... | |
Vector3 | GetTopCenter (Vector3 position) |
Gets the center of the top sphere of the collision shape. More... | |
Vector3 | GetTopCenter (Vector3 position, Vector2 bodySize) |
Gets the center of the top sphere of the collision shape (considering an arbitrary body size). More... | |
Vector3 | GetBottomCenter (Vector3 position, float bottomOffset=0f) |
Gets the center of the bottom sphere of the collision shape. More... | |
Vector3 | GetBottomCenter (Vector3 position, Vector2 bodySize) |
Gets the center of the bottom sphere of the collision shape (considering an arbitrary body size). More... | |
Vector3 | GetBottomCenterToTopCenter () |
Gets the a vector that goes from the bottom center to the top center (topCenter - bottomCenter). More... | |
Vector3 | GetBottomCenterToTopCenter (Vector2 bodySize) |
Gets the a vector that goes from the bottom center to the top center (topCenter - bottomCenter). More... | |
void | SetYaw (float angle) |
Rotates the character doing yaw rotation (around its vertical axis). More... | |
void | Teleport (Transform reference) |
Sets the teleportation position and rotation using an external Transform reference. The character will move/rotate internally using its own internal logic. More... | |
void | Teleport (Vector3 position, Quaternion rotation) |
Sets the teleportation position and rotation. The character will move/rotate internally using its own internal logic. More... | |
void | Teleport (Vector3 position) |
Sets the teleportation position. The character will move/rotate internally using its own internal logic. More... | |
void | Move (Vector3 position) |
Sets the rigidbody velocity based on a target position. The same can be achieved by setting the velocity value manually. More... | |
bool | SetBodySize (Vector2 size) |
Checks if the new character size fits in place. If this check is valid then the real size of the character is changed. More... | |
void | SweepAndTeleport (Vector3 destination) |
Sweeps the body from its current position (CharacterActor.Position) towards the desired destination using the "collide and slide" algorithm. At the end, the character will be moved to a valid position. Triggers and one way platforms will be ignored. More... | |
void | SweepAndTeleport (Vector3 destination, in HitInfoFilter filter) |
Sweeps the body from its current position (CharacterActor.Position) towards the desired destination using the "collide and slide" algorithm. At the end, the character will be moved to a valid position. More... | |
void | ForceGrounded () |
Forces the character to be grounded (isGrounded = true) if possible. The detection distance includes the step down distance. More... | |
Vector3 | GetGroundSlopeNormal (in CollisionInfo collisionInfo) |
void | ForceNotGrounded (int ignoreGroundContactFrames=3) |
Forces the character to abandon the grounded state (isGrounded = false). More... | |
bool | CheckOneWayPlatformLayerMask (CollisionInfo collisionInfo) |
bool | CheckOneWayPlatformCollision (Vector3 contactPoint, Vector3 characterPosition) |
Public Member Functions inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
void | SyncBody () |
void | InitializeAnimation (Animator animator) |
Configures all the animation-related components based on a given Animator component. The Animator provides root motion data along More... | |
void | ResetIKWeights () |
void | ResetInterpolationPosition () |
void | ResetInterpolationRotation () |
Public Attributes | |
LayerMask | oneWayPlatformsLayerMask = 0 |
float | oneWayPlatformsValidArc = 175f |
bool | useGroundTrigger = false |
bool | alwaysNotGrounded = false |
bool | forceGroundedAtStart = true |
LayerMask | stableLayerMask = -1 |
float | slopeLimit = 55f |
bool | useStableEdgeWhenLanding = true |
float | stepUpDistance = 0.5f |
float | stepDownDistance = 0.5f |
bool | edgeCompensation = false |
bool | detectGroundWhileAscending = false |
bool | preventUnstableClimbing = true |
bool | preventBadSteps = true |
bool | supportDynamicGround = true |
LayerMask | dynamicGroundLayerMask = -1 |
bool | rotateForwardDirection = true |
float | maxGroundVelocityChange = 30f |
float | inheritedGroundPlanarVelocityThreshold = 2f |
float | inheritedGroundPlanarVelocityMultiplier = 1f |
float | inheritedGroundVerticalVelocityThreshold = 2f |
float | inheritedGroundVerticalVelocityMultiplier = 1f |
bool | slideOnWalls = true |
CharacterVelocityMode | stablePostSimulationVelocity = CharacterVelocityMode.UsePostSimulationVelocity |
CharacterVelocityMode | unstablePostSimulationVelocity = CharacterVelocityMode.UsePostSimulationVelocity |
SizeReferenceType | sizeReferenceType = SizeReferenceType.Bottom |
float | sizeLerpSpeed = 8f |
bool | constraintRotation = true |
Transform | upDirectionReference = null |
VerticalAlignmentSettings.VerticalReferenceMode | upDirectionReferenceMode = VerticalAlignmentSettings.VerticalReferenceMode.Away |
Vector3 | constraintUpDirection = Vector3.up |
bool | canPushDynamicRigidbodies = true |
LayerMask | pushableRigidbodyLayerMask = -1 |
bool | applyWeightToGround = true |
float | weightGravity = CharacterConstants.DefaultGravity |
bool | Is2D => RigidbodyComponent.Is2D |
Gets the CharacterBody component associated with this character actor. More... | |
override RigidbodyComponent | RigidbodyComponent => CharacterBody.RigidbodyComponent |
Gets the RigidbodyComponent component associated with the character. More... | |
ColliderComponent | ColliderComponent => CharacterBody.ColliderComponent |
Gets the ColliderComponent component associated with the character. More... | |
LayerMask | ObstaclesLayerMask => PhysicsComponent.CollisionLayerMask | oneWayPlatformsLayerMask |
LayerMask | ObstaclesWithoutOWPLayerMask => PhysicsComponent.CollisionLayerMask & ~(oneWayPlatformsLayerMask) |
bool | IsOnEdge => characterCollisionInfo.isOnEdge |
Returns true if the character is standing on an edge. More... | |
float | EdgeAngle => characterCollisionInfo.edgeAngle |
Returns the angle between the both sides of the edge. More... | |
bool | IsGrounded => characterCollisionInfo.groundObject != null |
Gets the grounded state, true if the ground object is not null, false otherwise. More... | |
float | GroundSlopeAngle => characterCollisionInfo.groundSlopeAngle |
Gets the angle between the up vector and the stable normal. More... | |
Vector3 | GroundContactPoint => characterCollisionInfo.groundContactPoint |
Gets the contact point obtained directly from the ground test (sphere cast). More... | |
Vector3 | GroundContactNormal => characterCollisionInfo.groundContactNormal |
Gets the normal vector obtained directly from the ground test (sphere cast). More... | |
Vector3 | GroundStableNormal => IsStable ? characterCollisionInfo.groundStableNormal : Up |
Gets the normal vector used to determine stability. This may or may not be the normal obtained from the ground test. More... | |
GameObject | GroundObject => characterCollisionInfo.groundObject |
Gets the GameObject component of the current ground. More... | |
Transform | GroundTransform => GroundObject != null ? GroundObject.transform : null |
Gets the Transform component of the current ground. More... | |
Collider2D | GroundCollider2D => characterCollisionInfo.groundCollider2D |
Gets the Collider2D component of the current ground. More... | |
Collider | GroundCollider3D => characterCollisionInfo.groundCollider3D |
Gets the Collider3D component of the current ground. More... | |
Rigidbody2D | GroundRigidbody2D => characterCollisionInfo.groundRigidbody2D |
Gets the Rigidbody2D component of the current ground. More... | |
Rigidbody | GroundRigidbody3D => characterCollisionInfo.groundRigidbody3D |
Gets the Rigidbody component of the current ground. More... | |
bool | WallCollision => characterCollisionInfo.wallCollision |
Gets the wall collision flag, true if the character hit a wall, false otherwise. More... | |
float | WallAngle => characterCollisionInfo.wallAngle |
Gets the angle between the contact normal (wall collision) and the Up direction. More... | |
Contact | WallContact => characterCollisionInfo.wallContact |
Gets the current contact (wall collision). More... | |
bool | HeadCollision => characterCollisionInfo.headCollision |
Gets the head collision flag, true if the character hits something with its head, false otherwise. More... | |
float | HeadAngle => characterCollisionInfo.headAngle |
Gets the angle between the contact normal (head collision) and the Up direction. More... | |
Contact | HeadContact => characterCollisionInfo.headContact |
Gets the current contact (head collision). More... | |
bool | IsOnUnstableGround => IsGrounded && characterCollisionInfo.groundSlopeAngle > slopeLimit |
Returns true if the character is grounded onto an unstable ground, false otherwise. More... | |
CharacterCollisionInfo | CharacterCollisionInfo => characterCollisionInfo |
Gets a structure with all the information regarding character collisions. Most of the character properties (e.g. IsGrounded, IsStable, GroundObject, and so on) can be obtained from this structure. More... | |
Vector2 | DefaultBodySize => CharacterBody.BodySize |
Gets the current body size (width and height). More... | |
CharacterCollisions | CharacterCollisions => characterCollisions |
List< Contact > | WallContacts => wallContacts |
Returns a lits of all the contacts involved with wall collision events. More... | |
List< Contact > | HeadContacts => headContacts |
Returns a lits of all the contacts involved with head collision events. More... | |
List< Contact > | GroundContacts => groundContacts |
Returns a lits of all the contacts involved with head collision events. More... | |
Vector3 | GroundDeltaVelocity => GroundVelocity - PreviousGroundVelocity |
The ground change in velocity (current velocity - previous velocity). More... | |
Vector3 | GroundAcceleration => (GroundVelocity - PreviousGroundVelocity) / Time.fixedDeltaTime |
The ground acceleration (GroundDeltaVelocity / dt). More... | |
bool | IsGroundAscending => transform.InverseTransformVectorUnscaled(Vector3.Project(CustomUtilities.Multiply(GroundVelocity, Time.deltaTime), Up)).y > 0 |
Returns true if the ground vertical displacement (moving ground) is positive. More... | |
bool | IsGroundAOneWayPlatform => CustomUtilities.BelongsToLayerMask(GroundObject.layer, oneWayPlatformsLayerMask) |
Returns true if the current ground layer is considered as a one way platform. More... | |
bool | CanEnterGroundedState => !alwaysNotGrounded && forceNotGroundedFrames == 0 |
Public Attributes inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
bool | interpolateActor = true |
bool | useContinuousCollisionDetection = true |
bool | UseRootMotion = false |
bool | UpdateRootPosition = true |
RootMotionVelocityType | rootMotionVelocityType = RootMotionVelocityType.SetVelocity |
bool | UpdateRootRotation = true |
RootMotionRotationType | rootMotionRotationType = RootMotionRotationType.AddRotation |
Protected Member Functions | |
override void | Awake () |
override void | Start () |
override void | OnEnable () |
override void | OnDisable () |
virtual void | ApplyWeight (Vector3 contactPoint) |
Applies a force at the ground contact point, in the direction of the weight (mass times gravity). More... | |
override void | PreSimulationUpdate (float dt) |
override void | PostSimulationUpdate (float dt) |
override void | UpdateDynamicRootMotionPosition (Vector3 deltaPosition) |
void | StableCollideAndSlide (ref Vector3 position, Vector3 displacement, bool useFullBody) |
void | PostSimulationCollideAndSlide (ref Vector3 position, ref Quaternion rotation, Vector3 displacement, bool useFullBody) |
void | UnstableCollideAndSlide (ref Vector3 position, Vector3 displacement, float dt) |
Protected Member Functions inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
virtual void | UpdateKinematicRootMotionPosition (Vector3 deltaPosition) |
virtual void | UpdateKinematicRootMotionRotation (Quaternion deltaRotation) |
virtual void | UpdateDynamicRootMotionRotation (Quaternion deltaRotation) |
Protected Attributes | |
CharacterCollisionInfo | characterCollisionInfo = new CharacterCollisionInfo() |
Properties | |
float | StepOffset [get] |
PhysicsComponent | PhysicsComponent [get] |
Gets the physics component from the character. More... | |
CharacterBody | CharacterBody [get] |
Gets the CharacterBody component associated with this character actor. More... | |
CharacterActorState? | CurrentState [get] |
Returns the current character actor state. This enum variable contains the information about the grounded and stable state, all in one. More... | |
CharacterActorState? | PreviousState [get] |
Returns the character actor state from the previous frame. More... | |
bool | IsStable [get] |
Gets the current stability state of the character. Stability is equal to "grounded + slope angle <= slope limit". More... | |
bool | WasGrounded [get] |
Gets the previous grounded state. More... | |
bool | WasStable [get] |
Gets the previous stability state. More... | |
RigidbodyComponent | GroundRigidbodyComponent [get] |
Gets the RigidbodyComponent component from the ground. More... | |
Vector3? | GroundPosition [get] |
Gets the ground rigidbody position. More... | |
Quaternion? | GroundRotation [get] |
Gets the ground rigidbody rotation. More... | |
bool? | IsGroundARigidbody [get] |
Returns true if the current ground is a Rigidbody (2D or 3D), false otherwise. More... | |
bool? | IsGroundAKinematicRigidbody [get] |
Returns true if the current ground is a kinematic Rigidbody (2D or 3D), false otherwise. More... | |
float | GroundedTime [get] |
float | NotGroundedTime [get] |
float | StableElapsedTime [get] |
float | UnstableElapsedTime [get] |
Vector2 | BodySize [get] |
Gets the current body size (width and height). More... | |
Vector3 | Velocity [get, set] |
Gets/Sets the rigidbody velocity. More... | |
Vector3 | PlanarVelocity [get, set] |
Gets/Sets the rigidbody velocity projected onto a plane formed by its up direction. More... | |
Vector3 | VerticalVelocity [get, set] |
Gets/Sets the rigidbody velocity projected onto its up direction. More... | |
Vector3 | StableVelocity [get, set] |
Gets/Sets the rigidbody velocity projected onto a plane formed by its up direction. More... | |
Vector3 | LastGroundedVelocity [get] |
Vector3 | LocalVelocity [get, set] |
Gets/Sets the rigidbody local velocity. More... | |
Vector3 | LocalPlanarVelocity [get, set] |
Gets/Sets the rigidbody local planar velocity. More... | |
bool | IsFalling [get] |
Returns true if the character local vertical velocity is less than zero. More... | |
bool | IsAscending [get] |
Returns true if the character local vertical velocity is greater than zero. More... | |
Vector3 | Center [get] |
Gets the center of the collision shape. More... | |
Vector3 | Top [get] |
Gets the center of the collision shape. More... | |
Vector3 | Bottom [get] |
Gets the center of the collision shape. More... | |
Vector3 | TopCenter [get] |
Gets the center of the collision shape. More... | |
Vector3 | BottomCenter [get] |
Gets the center of the collision shape. More... | |
Vector3 | OffsettedBottomCenter [get] |
Gets the center of the collision shape. More... | |
Vector3 | Position [get, set] |
Gets/Sets the current rigidbody position. This action will produce an "interpolation reset", meaning that (visually) the object will move instantly to the target. More... | |
Quaternion | Rotation [get, set] |
Gets/Sets the current rigidbody rotation. This action will produce an "interpolation reset", meaning that (visually) the object will rotate instantly to the target. More... | |
Vector3 | Up [get, set] |
Gets/Sets the current up direction based on the rigidbody rotation (not necessarily transform.up). More... | |
Vector3? | Forward [get, set] |
Gets/Sets the current forward direction based on the rigidbody rotation (not necessarily transform.forward). More... | |
Vector3 | Right [get] |
Gets the current up direction based on the rigidbody rotation (not necessarily transform.right). More... | |
List< Contact > | Contacts [get] |
Gets a list with all the current contacts. More... | |
Trigger | CurrentTrigger [get] |
Gets the most recent trigger. More... | |
List< Trigger > | Triggers [get] |
Gets a list with all the triggers. More... | |
bool | IsKinematic [get, set] |
Vector3 | InputVelocity [get] |
Gets the character velocity vector (Velocity) assigned prior to the FixedUpdate call. This is also known as the "input" velocity, since it is the value the user has specified. More... | |
Vector3 | PreSimulationVelocity [get] |
Gets a velocity vector which is the input velocity modified, based on the character actor internal rules (step up, slope limit, etc). This velocity corresponds to the one used by the physics simulation. More... | |
Vector3 | PostSimulationVelocity [get] |
Gets the character velocity as the result of the Physics simulation. More... | |
Vector3 | ExternalVelocity [get] |
Gets the difference between the post-simulation velocity (after the physics simulation) and the pre-simulation velocity (just before the physics simulation). This value is useful to detect any external response due to the physics simulation, such as hits coming from other rigidbodies. More... | |
Vector3 | GroundVelocity [get] |
Gets the velocity of the ground (rigidbody). More... | |
Vector3 | PreviousGroundVelocity [get] |
Gets the previous velocity of the ground (rigidbody). More... | |
Vector3 | GroundProbingDisplacement [get] |
The last vertical displacement calculated by the ground probabing algorithm (PostGroundProbingPosition - PreGroundProbingPosition). More... | |
Vector3 | PreGroundProbingPosition [get] |
The last rigidbody position prior to the ground probing algorithm. More... | |
Vector3 | PostGroundProbingPosition [get] |
The last rigidbody position after the ground probing algorithm. More... | |
GameObject | PredictedGround [get] |
Gets the object below the character (only valid if the character is falling). The maximum prediction distance is defined by the constant "GroundPredictionDistance". More... | |
float | PredictedGroundDistance [get] |
Gets the distance to the "PredictedGround". More... | |
Properties inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
abstract RigidbodyComponent | RigidbodyComponent [get] |
Gets the RigidbodyComponent component associated with the character. More... | |
Animator | Animator [get] |
Gets the Animator component associated with the state controller. More... | |
float | InterpolationFactor [get] |
Returns a value between 0 and 1 that represents the interpolation t factor used by the interpolation algorithm. If the current time value (Time.time) is close to the most recent fixed time (Time.fixedTime), then the factor will be close to 0. On the other hand, if the current time is close to the next fixed time value (Time.fixedTime + Time.fixedDeltaTime) then the factor will be close to 1. More... | |
Events | |
System.Action< Contact > | OnHeadHit |
This event is called when the character hits its head (not grounded). More... | |
System.Action< Contact > | OnWallHit |
This event is called everytime the character is blocked by an unallowed geometry, this could be a wall or a steep slope (depending on the "slopeLimit" value). More... | |
System.Action< Vector3, Quaternion > | OnTeleport |
This event is called everytime the character teleports. More... | |
System.Action< Vector3 > | OnGroundedStateEnter |
This event is called when the character enters the grounded state. More... | |
System.Action | OnGroundedStateExit |
This event is called when the character exits the grounded state. More... | |
System.Action | OnNewGroundEnter |
This event is called when the character make contact with a new ground (object). More... | |
Events inherited from Lightbug.CharacterControllerPro.Core.PhysicsActor | |
System.Action< float > | OnPreSimulation |
This event is called prior to the physics simulation. More... | |
System.Action< float > | OnPostSimulation |
This event is called after the physics simulation. More... | |
System.Action< Vector3, Quaternion > | OnAnimatorMoveEvent |
System.Action< int > | OnAnimatorIKEvent |
This class represents a character actor. It contains all the character information, collision flags, collision events, and so on. It also responsible for the execution order of everything related to the character, such as movement, rotation, teleportation, rigidbodies interactions, body size, etc. Since the character can be 2D or 3D, this abstract class must be implemented in the two formats, one for 2D and one for 3D.
|
inlineprotectedvirtual |
Applies a force at the ground contact point, in the direction of the weight (mass times gravity).
|
inline |
Forces the character to be grounded (isGrounded = true) if possible. The detection distance includes the step down distance.
|
inline |
Forces the character to abandon the grounded state (isGrounded = false).
TIP: This is useful when making the character jump.
ignoreGroundContactFrames | The number of FixedUpdate frames to consume in order to prevent the character to re-enter grounded state right after a ForceNotGrounded call. |
|
inline |
Gets the bottom most point of the collision shape.
|
inline |
Gets the center of the bottom sphere of the collision shape.
|
inline |
Gets the center of the bottom sphere of the collision shape (considering an arbitrary body size).
|
inline |
Gets the a vector that goes from the bottom center to the top center (topCenter - bottomCenter).
|
inline |
Gets the a vector that goes from the bottom center to the top center (topCenter - bottomCenter).
|
inline |
Gets the center of the collision shape.
|
inline |
Returns the point velocity (Rigidbody API) of the ground at a given position.
|
inline |
Gets the top most point of the collision shape.
|
inline |
Gets the center of the top sphere of the collision shape.
|
inline |
Gets the center of the top sphere of the collision shape (considering an arbitrary body size).
|
inline |
Sets the rigidbody velocity based on a target position. The same can be achieved by setting the velocity value manually.
|
inline |
Checks if the new character size fits in place. If this check is valid then the real size of the character is changed.
|
inline |
Sets up root motion for this actor.
|
inline |
Sets up root motion for this actor.
|
inline |
Rotates the character doing yaw rotation (around its vertical axis).
angle | The angle in degrees. |
|
inline |
Sweeps the body from its current position (CharacterActor.Position) towards the desired destination using the "collide and slide" algorithm. At the end, the character will be moved to a valid position. Triggers and one way platforms will be ignored.
|
inline |
Sweeps the body from its current position (CharacterActor.Position) towards the desired destination using the "collide and slide" algorithm. At the end, the character will be moved to a valid position.
|
inline |
Sets the teleportation position and rotation using an external Transform reference. The character will move/rotate internally using its own internal logic.
|
inline |
Sets the teleportation position and rotation. The character will move/rotate internally using its own internal logic.
|
inline |
Sets the teleportation position. The character will move/rotate internally using its own internal logic.
|
inline |
Returns a concatenated string containing all the current collision information.
CharacterCollisionInfo Lightbug.CharacterControllerPro.Core.CharacterActor.CharacterCollisionInfo => characterCollisionInfo |
Gets a structure with all the information regarding character collisions. Most of the character properties (e.g. IsGrounded, IsStable, GroundObject, and so on) can be obtained from this structure.
ColliderComponent Lightbug.CharacterControllerPro.Core.CharacterActor.ColliderComponent => CharacterBody.ColliderComponent |
Gets the ColliderComponent component associated with the character.
Vector2 Lightbug.CharacterControllerPro.Core.CharacterActor.DefaultBodySize => CharacterBody.BodySize |
Gets the current body size (width and height).
float Lightbug.CharacterControllerPro.Core.CharacterActor.EdgeAngle => characterCollisionInfo.edgeAngle |
Returns the angle between the both sides of the edge.
Vector3 Lightbug.CharacterControllerPro.Core.CharacterActor.GroundAcceleration => (GroundVelocity - PreviousGroundVelocity) / Time.fixedDeltaTime |
The ground acceleration (GroundDeltaVelocity / dt).
Collider2D Lightbug.CharacterControllerPro.Core.CharacterActor.GroundCollider2D => characterCollisionInfo.groundCollider2D |
Gets the Collider2D component of the current ground.
Collider Lightbug.CharacterControllerPro.Core.CharacterActor.GroundCollider3D => characterCollisionInfo.groundCollider3D |
Gets the Collider3D component of the current ground.
Vector3 Lightbug.CharacterControllerPro.Core.CharacterActor.GroundContactNormal => characterCollisionInfo.groundContactNormal |
Gets the normal vector obtained directly from the ground test (sphere cast).
Vector3 Lightbug.CharacterControllerPro.Core.CharacterActor.GroundContactPoint => characterCollisionInfo.groundContactPoint |
Gets the contact point obtained directly from the ground test (sphere cast).
List<Contact> Lightbug.CharacterControllerPro.Core.CharacterActor.GroundContacts => groundContacts |
Returns a lits of all the contacts involved with head collision events.
Vector3 Lightbug.CharacterControllerPro.Core.CharacterActor.GroundDeltaVelocity => GroundVelocity - PreviousGroundVelocity |
The ground change in velocity (current velocity - previous velocity).
GameObject Lightbug.CharacterControllerPro.Core.CharacterActor.GroundObject => characterCollisionInfo.groundObject |
Gets the GameObject component of the current ground.
Rigidbody2D Lightbug.CharacterControllerPro.Core.CharacterActor.GroundRigidbody2D => characterCollisionInfo.groundRigidbody2D |
Gets the Rigidbody2D component of the current ground.
Rigidbody Lightbug.CharacterControllerPro.Core.CharacterActor.GroundRigidbody3D => characterCollisionInfo.groundRigidbody3D |
Gets the Rigidbody component of the current ground.
float Lightbug.CharacterControllerPro.Core.CharacterActor.GroundSlopeAngle => characterCollisionInfo.groundSlopeAngle |
Gets the angle between the up vector and the stable normal.
Vector3 Lightbug.CharacterControllerPro.Core.CharacterActor.GroundStableNormal => IsStable ? characterCollisionInfo.groundStableNormal : Up |
Gets the normal vector used to determine stability. This may or may not be the normal obtained from the ground test.
Transform Lightbug.CharacterControllerPro.Core.CharacterActor.GroundTransform => GroundObject != null ? GroundObject.transform : null |
Gets the Transform component of the current ground.
float Lightbug.CharacterControllerPro.Core.CharacterActor.HeadAngle => characterCollisionInfo.headAngle |
Gets the angle between the contact normal (head collision) and the Up direction.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.HeadCollision => characterCollisionInfo.headCollision |
Gets the head collision flag, true if the character hits something with its head, false otherwise.
Contact Lightbug.CharacterControllerPro.Core.CharacterActor.HeadContact => characterCollisionInfo.headContact |
Gets the current contact (head collision).
List<Contact> Lightbug.CharacterControllerPro.Core.CharacterActor.HeadContacts => headContacts |
Returns a lits of all the contacts involved with head collision events.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.Is2D => RigidbodyComponent.Is2D |
Gets the CharacterBody component associated with this character actor.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.IsGroundAOneWayPlatform => CustomUtilities.BelongsToLayerMask(GroundObject.layer, oneWayPlatformsLayerMask) |
Returns true if the current ground layer is considered as a one way platform.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.IsGroundAscending => transform.InverseTransformVectorUnscaled(Vector3.Project(CustomUtilities.Multiply(GroundVelocity, Time.deltaTime), Up)).y > 0 |
Returns true if the ground vertical displacement (moving ground) is positive.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.IsGrounded => characterCollisionInfo.groundObject != null |
Gets the grounded state, true if the ground object is not null, false otherwise.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.IsOnEdge => characterCollisionInfo.isOnEdge |
Returns true if the character is standing on an edge.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.IsOnUnstableGround => IsGrounded && characterCollisionInfo.groundSlopeAngle > slopeLimit |
Returns true if the character is grounded onto an unstable ground, false otherwise.
override RigidbodyComponent Lightbug.CharacterControllerPro.Core.CharacterActor.RigidbodyComponent => CharacterBody.RigidbodyComponent |
Gets the RigidbodyComponent component associated with the character.
float Lightbug.CharacterControllerPro.Core.CharacterActor.WallAngle => characterCollisionInfo.wallAngle |
Gets the angle between the contact normal (wall collision) and the Up direction.
bool Lightbug.CharacterControllerPro.Core.CharacterActor.WallCollision => characterCollisionInfo.wallCollision |
Gets the wall collision flag, true if the character hit a wall, false otherwise.
Contact Lightbug.CharacterControllerPro.Core.CharacterActor.WallContact => characterCollisionInfo.wallContact |
Gets the current contact (wall collision).
List<Contact> Lightbug.CharacterControllerPro.Core.CharacterActor.WallContacts => wallContacts |
Returns a lits of all the contacts involved with wall collision events.
|
get |
Gets the current body size (width and height).
|
get |
Gets the center of the collision shape.
|
get |
Gets the center of the collision shape.
|
get |
Gets the center of the collision shape.
|
get |
Gets the CharacterBody component associated with this character actor.
|
get |
Gets a list with all the current contacts.
|
get |
Returns the current character actor state. This enum variable contains the information about the grounded and stable state, all in one.
|
get |
Gets the most recent trigger.
|
get |
Gets the difference between the post-simulation velocity (after the physics simulation) and the pre-simulation velocity (just before the physics simulation). This value is useful to detect any external response due to the physics simulation, such as hits coming from other rigidbodies.
|
getset |
Gets/Sets the current forward direction based on the rigidbody rotation (not necessarily transform.forward).
|
get |
Gets the ground rigidbody position.
|
get |
The last vertical displacement calculated by the ground probabing algorithm (PostGroundProbingPosition - PreGroundProbingPosition).
|
get |
Gets the RigidbodyComponent component from the ground.
|
get |
Gets the ground rigidbody rotation.
|
get |
Gets the velocity of the ground (rigidbody).
|
get |
Gets the character velocity vector (Velocity) assigned prior to the FixedUpdate call. This is also known as the "input" velocity, since it is the value the user has specified.
|
get |
Returns true if the character local vertical velocity is greater than zero.
|
get |
Returns true if the character local vertical velocity is less than zero.
|
get |
Returns true if the current ground is a kinematic Rigidbody (2D or 3D), false otherwise.
|
get |
Returns true if the current ground is a Rigidbody (2D or 3D), false otherwise.
|
get |
Gets the current stability state of the character. Stability is equal to "grounded + slope angle <= slope limit".
|
getset |
Gets/Sets the rigidbody local planar velocity.
|
getset |
Gets/Sets the rigidbody local velocity.
|
get |
Gets the center of the collision shape.
|
get |
Gets the physics component from the character.
|
getset |
Gets/Sets the rigidbody velocity projected onto a plane formed by its up direction.
|
getset |
Gets/Sets the current rigidbody position. This action will produce an "interpolation reset", meaning that (visually) the object will move instantly to the target.
|
get |
The last rigidbody position after the ground probing algorithm.
|
get |
Gets the character velocity as the result of the Physics simulation.
|
get |
Gets the object below the character (only valid if the character is falling). The maximum prediction distance is defined by the constant "GroundPredictionDistance".
|
get |
Gets the distance to the "PredictedGround".
|
get |
The last rigidbody position prior to the ground probing algorithm.
|
get |
Gets a velocity vector which is the input velocity modified, based on the character actor internal rules (step up, slope limit, etc). This velocity corresponds to the one used by the physics simulation.
|
get |
Gets the previous velocity of the ground (rigidbody).
|
get |
Returns the character actor state from the previous frame.
|
get |
Gets the current up direction based on the rigidbody rotation (not necessarily transform.right).
|
getset |
Gets/Sets the current rigidbody rotation. This action will produce an "interpolation reset", meaning that (visually) the object will rotate instantly to the target.
|
getset |
Gets/Sets the rigidbody velocity projected onto a plane formed by its up direction.
|
get |
Gets the center of the collision shape.
|
get |
Gets the center of the collision shape.
|
get |
Gets a list with all the triggers.
|
getset |
Gets/Sets the current up direction based on the rigidbody rotation (not necessarily transform.up).
|
getset |
Gets/Sets the rigidbody velocity.
|
getset |
Gets/Sets the rigidbody velocity projected onto its up direction.
|
get |
Gets the previous grounded state.
|
get |
Gets the previous stability state.
System.Action<Vector3> Lightbug.CharacterControllerPro.Core.CharacterActor.OnGroundedStateEnter |
This event is called when the character enters the grounded state.
The local linear velocity is passed as an argument.
System.Action Lightbug.CharacterControllerPro.Core.CharacterActor.OnGroundedStateExit |
This event is called when the character exits the grounded state.
System.Action<Contact> Lightbug.CharacterControllerPro.Core.CharacterActor.OnHeadHit |
This event is called when the character hits its head (not grounded).
The related collision information struct is passed as an argument.
System.Action Lightbug.CharacterControllerPro.Core.CharacterActor.OnNewGroundEnter |
This event is called when the character make contact with a new ground (object).
System.Action<Vector3, Quaternion> Lightbug.CharacterControllerPro.Core.CharacterActor.OnTeleport |
This event is called everytime the character teleports.
The teleported position and rotation are passed as arguments.
System.Action<Contact> Lightbug.CharacterControllerPro.Core.CharacterActor.OnWallHit |
This event is called everytime the character is blocked by an unallowed geometry, this could be a wall or a steep slope (depending on the "slopeLimit" value).
The related collision information struct is passed as an argument.