Summary
Manages the
UnityEngine.Collider2D and UnityEngine.Rigidbody2D of a PlatformerGameKit.Characters.Character.- Assembly
- PlatformerGameKit
.dll - Namespace
- PlatformerGameKit
.Characters - Base Types
-
- MonoBehaviour
- Derived Types
graph BT
Type-->Base0["MonoBehaviour"]
Type["CharacterBody2D"]
class Type type-node
Derived0["BoxCharacterBody2D"]-->Type
click Derived0 "/platformer/api/PlatformerGameKit.Characters/BoxCharacterBody2D"
Syntax
[AddComponentMenu(Character.MenuPrefix + "Character Body 2D")]
[PlatformerHelpUrl(typeof(CharacterBody2D))]
[DefaultExecutionOrder(DefaultExecutionOrder)]
public class CharacterBody2D : MonoBehaviour
Remarks
Documentation:
Physics - Character Body
Attributes
| Type | Description |
|---|---|
| AddComponentMenu | |
| Platformer |
[Assert-Conditional]
A UnityEngine.HelpURLAttribute which points to Platformer Game Kit's documentation.
|
| Default |
Events
| Name | Type | Summary |
|---|---|---|
| OnGroundedChanged | Action |
Called when
PlatformerGameKit.Characters.CharacterBody2D.IsGrounded is changed. |
Fields
| Name | Constant Value | Summary |
|---|---|---|
| Default |
-9000 |
Run after being controlled but before states react to
PlatformerGameKit.Characters.CharacterBody2D.IsGrounded.static
|
Properties
| Name | Value | Summary |
|---|---|---|
| Collider | Collider2D |
[
UnityEngine.SerializeField] The character's UnityEngine.Collider2D. |
| Gravity | Vector2 |
The acceleration that gravity is currently applying to this body.
|
| GripAngle | float |
The largest angle that a contact point can have between the local up and its normal to be considered a
PlatformerGameKit.Characters.CharacterBody2D.GroundContact and set PlatformerGameKit.Characters.CharacterBody2D.IsGrounded to true.
|
| GroundContact | PlatformContact2D |
Details of the current contact point with the ground.
|
| IsGrounded | bool |
Is this body currently on the ground?
|
| Mass | float |
The
UnityEngine.Rigidbody2D.mass. |
| Position | Vector2 |
The
UnityEngine.Rigidbody2D.position. |
| Rigidbody | Rigidbody2D |
[
UnityEngine.SerializeField] The character's UnityEngine.Rigidbody2D. |
| Rotation | float |
The
UnityEngine.Rigidbody2D.rotation (currently fixed at 0). |
| StepHeight | float |
The maximum height that this body can snap up or down a step to remain on the ground.
|
| TerrainFilter | ContactFilter2D |
A
UnityEngine.ContactFilter2D using the layer mask of the layers that this object collides with. |
| Velocity | Vector2 |
The
UnityEngine.Rigidbody2D.velocity. |
Methods
| Name | Value | Summary |
|---|---|---|
| Awake |
void |
Initializes the
PlatformerGameKit.Characters.CharacterBody2D.TerrainFilter. |
| OnDisable |
void |
Sets
PlatformerGameKit.Characters.CharacterBody2D.IsGrounded to false. |
| OnValidate |
void |
[Editor-Only] Ensures that all fields have valid values and finds missing components nearby.
|