More...
Inherits Quantum.IComponent.
|
int | AddBroadPhaseQuery (FrameBase frame, EntityRef entity, int? layerMask=null) |
| Adds a Broad-phase query to the 3D Physics scene, according to the KCC config settings, and store the query index in BroadPhaseQueryIndex. This index will be used on the next time Move or ComputeRawMovement is called, to retrieve the resolved query results and perform the KCC logic. More...
|
|
void | Init (FrameBase frame, CharacterController3DConfig config=null) |
| Initializes the 3D character controller component. More...
|
|
void | Jump (FrameBase frame, bool ignoreGrounded=false, FP? impulse=null) |
| Applies a vertical impulse to the KCC velocity. More...
|
|
void | Move (FrameBase frame, EntityRef entity, FPVector3 direction, IKCCCallbacks3D callback=null, int? layerMask=null, Boolean? useManifoldNormal=null, FP? deltaTime=null) |
| Queries the 3D physics scene with CharacterController3D.ComputeRawMovement(FrameBase, EntityRef, Transform3D*, CharacterController3D*, FPVector3, IKCCCallbacks3D, int?, bool?), computes a default steering in the desired direction and moves the entity . More...
|
|
void | SetConfig (FrameBase frame, CharacterController3DConfig config=null) |
| Sets or changes this KCC's config. More...
|
|
|
static CharacterController3DMovement | ComputeRawMovement (FrameBase frame, EntityRef entity, Transform3D *transform, CharacterController3D *kcc, FPVector3 direction, IKCCCallbacks3D callback=null, int? layerMask=null, bool? useManifoldNormal=null) |
| Queries the 3D physics scene in the transform position, using the kcc config, and computes movement data. The movement data can be used to apply a custom steering to the character based on its surrounding environment. For using the default steering, use Move(FrameBase, EntityRef, FPVector3, IKCCCallbacks3D, int?, bool?, FP?). More...
|
|
|
int? | BroadPhaseQueryIndex [get, set] |
| The index of the Broad-Phase Query added by calling AddBroadPhaseQuery, -1 if no query has been added. This index will be used on the next time Move or ComputeRawMovement is called, to retrieve the resolved query results, and is automatically reset when that happens. Set this value to -1 in order to not use the BP Query result in the KCC movement. In this case a regular query will be performed, as by default. More...
|
|
Boolean? | Jumped [get, set] |
| If the character jumped this frame. See Jump(FrameBase, bool, FP?). More...
|
|
◆ Init()
void Quantum.CharacterController3D.Init |
( |
FrameBase |
frame, |
|
|
CharacterController3DConfig |
config = null |
|
) |
| |
|
inline |
Initializes the 3D character controller component.
Use SetConfig instead in order to set or change the KCC config without resetting other fields. This method is not thread-safe: use the thread-safe overload if calling from a multi-threaded context.
- Parameters
-
frame | The current Frame. |
config | The KCC CharacterController3DConfig asset. If none is provided, the default config asset is used. |
◆ SetConfig()
void Quantum.CharacterController3D.SetConfig |
( |
FrameBase |
frame, |
|
|
CharacterController3DConfig |
config = null |
|
) |
| |
|
inline |
Sets or changes this KCC's config.
This method does not reset other values like Grounded and Velocity: use Init for that. This method is not thread-safe: use the thread-safe overload if calling from a threaded context.
- Parameters
-
frame | The current Frame. |
config | The KCC CharacterController3DConfig asset. If none is provided, the default config asset is used. |
◆ Jump()
void Quantum.CharacterController3D.Jump |
( |
FrameBase |
frame, |
|
|
bool |
ignoreGrounded = false , |
|
|
FP? |
impulse = null |
|
) |
| |
|
inline |
Applies a vertical impulse to the KCC velocity.
This method is not thread-safe. Use the thread-safe overload if calling from a threaded context.
No steering is performed at this stage. To actually move the character, use Move(FrameBase, EntityRef, FPVector3, IKCCCallbacks3D, int?, bool?, FP?).
- Parameters
-
frame | The frame object. |
ignoreGrounded | If the Grounded state of the KCC should be ignored. |
impulse | The amount of impulse applied to the KCC. If none is provided, the CharacterController3DConfig.BaseJumpImpulse of the KCC config is used. |
◆ AddBroadPhaseQuery()
int Quantum.CharacterController3D.AddBroadPhaseQuery |
( |
FrameBase |
frame, |
|
|
EntityRef |
entity, |
|
|
int? |
layerMask = null |
|
) |
| |
|
inline |
Adds a Broad-phase query to the 3D Physics scene, according to the KCC config settings, and store the query index in BroadPhaseQueryIndex. This index will be used on the next time Move or ComputeRawMovement is called, to retrieve the resolved query results and perform the KCC logic.
The added BP-Query must be retrieve on the same frame. To cancel the addition of a BP-Query and perform a regular one when moving the KCC, set BroadPhaseQueryIndex to -1.
- Parameters
-
frame | The current frame object. |
entity | The entity that represents the character. It must have a Transform3D component, which will be used to compute the query position. |
layerMask | A mask that specifies which layers should be considered by the query. If null (default), the layer maks defined in the KCC config will be used. |
- Returns
- The index of the added query.
◆ Move()
void Quantum.CharacterController3D.Move |
( |
FrameBase |
frame, |
|
|
EntityRef |
entity, |
|
|
FPVector3 |
direction, |
|
|
IKCCCallbacks3D |
callback = null , |
|
|
int? |
layerMask = null , |
|
|
Boolean? |
useManifoldNormal = null , |
|
|
FP? |
deltaTime = null |
|
) |
| |
|
inline |
Queries the 3D physics scene with CharacterController3D.ComputeRawMovement(FrameBase, EntityRef, Transform3D*, CharacterController3D*, FPVector3, IKCCCallbacks3D, int?, bool?), computes a default steering in the desired direction and moves the entity .
This method is not thread-safe. Use the thread-safe overload if calling from a threaded context.
The entity must have a Transform3D component.
- Parameters
-
frame | The frame in which the entity is being moved. |
entity | The entity that represents the character. Any collider attached by this entity is ignored in the raw movement computation. |
direction | The intended movement direction. |
callback | An object that can receive the KCC callbacks. If calling from a system that implements the interface, you can use the "this" keyword. |
layerMask | A mask that specifies which layers will be checked against in the raw movement computation. If null is passed, the layer maks defined in the KCC config will be used. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property. |
useManifoldNormal | If the hit manifold normal should be used when computing the raw movement. If false, the normal is computed from the query position and the contact point. If no value is provided, the CharacterController3DConfig.UseManifoldNormal of the KCC config is used. |
deltaTime | The delta timed used to integrate the kcc velocity. If no value is provided, the frame delta time is used. |
◆ ComputeRawMovement()
Queries the 3D physics scene in the transform position, using the kcc config, and computes movement data. The movement data can be used to apply a custom steering to the character based on its surrounding environment. For using the default steering, use Move(FrameBase, EntityRef, FPVector3, IKCCCallbacks3D, int?, bool?, FP?).
- Parameters
-
frame | The frame in which the physics scene is being queried. |
entity | The entity that represents the character. Any collider attached by this entity is ignored in the raw movement computation. |
transform | A pointer to a Transform3D component that has the position where the scene will be queried at, usually being the entity transform. |
kcc | A pointer to a CharacterController3D component that has the config used by the query, usually being the entity kcc component. |
direction | The intended movement direction. |
callback | An object that can receive the KCC callbacks. |
If calling from a system that implements the interface, you can use the "this" keyword.
- Parameters
-
layerMask | A mask that specifies which layers will be checked against in the raw movement computation. If null is passed, the layer maks defined in the KCC config will be used. To create a layer mask, see LayerInfo.GetLayerMask(string) and overloads on the frame.Layers property. |
useManifoldNormal | If the hit manifold normal should be used when computing the raw movement. If false, the normal is computed from the query position and the contact point. If no value is provided, the CharacterController3DConfig.UseManifoldNormal of the KCC config is used. |
- Returns
- A CharacterController3DMovement struct with raw movement data that can be used to compute a custom steering.
◆ Jumped
Boolean? Quantum.CharacterController3D.Jumped |
|
getset |
If the character jumped this frame. See Jump(FrameBase, bool, FP?).
This state is consumed in the default steering method Move(FrameBase, EntityRef, FPVector3, IKCCCallbacks3D, int?, bool?, FP?).
◆ BroadPhaseQueryIndex
int? Quantum.CharacterController3D.BroadPhaseQueryIndex |
|
getset |
The index of the Broad-Phase Query added by calling AddBroadPhaseQuery, -1 if no query has been added. This index will be used on the next time Move or ComputeRawMovement is called, to retrieve the resolved query results, and is automatically reset when that happens. Set this value to -1 in order to not use the BP Query result in the KCC movement. In this case a regular query will be performed, as by default.