BoxCharacterBody2D Class

Summary

Moves a ground-based PlatformerGameKit.Characters.Character with a UnityEngine.BoxCollider2D.
Assembly
PlatformerGameKit.dll
Namespace
PlatformerGameKit.Characters
Base Types
graph BT Type-->Base0["CharacterBody2D"] click Base0 "/platformer/api/PlatformerGameKit.Characters/CharacterBody2D" Base0-->Base1["MonoBehaviour"] Type["BoxCharacterBody2D"] class Type type-node

Syntax

[AddComponentMenu(Character.MenuPrefix + "Box Character Body 2D")]
[PlatformerHelpUrl(typeof(BoxCharacterBody2D))]
public class BoxCharacterBody2D : CharacterBody2D

Remarks

Documentation: Physics - Character Body

Attributes

Type Description
AddComponentMenu
PlatformerHelpUrlAttribute [Assert-Conditional] A UnityEngine.HelpURLAttribute which points to Platformer Game Kit's documentation.

Events

Name Type Summary
OnGroundedChanged Action<bool>
Called when PlatformerGameKit.Characters.CharacterBody2D.IsGrounded is changed.
Inherited from CharacterBody2D

Fields

Name Constant Value Summary
DefaultExecutionOrder -9000
Run after being controlled but before states react to PlatformerGameKit.Characters.CharacterBody2D.IsGrounded.
Inherited from CharacterBody2D
static

Properties

Name Value Summary
Collider Collider2D
[UnityEngine.SerializeField] The character's UnityEngine.Collider2D.
Inherited from CharacterBody2D
DebugLineDuration float
[Editor-Only] Determines how long scene view debug lines are shown for this object.
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?
Inherited from CharacterBody2D
Mass float
The UnityEngine.Rigidbody2D.mass.
Inherited from CharacterBody2D
Position Vector2
The UnityEngine.Rigidbody2D.position.
Inherited from CharacterBody2D
Rigidbody Rigidbody2D
[UnityEngine.SerializeField] The character's UnityEngine.Rigidbody2D.
Inherited from CharacterBody2D
Rotation float
The UnityEngine.Rigidbody2D.rotation (currently fixed at 0).
Inherited from CharacterBody2D
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.
Inherited from CharacterBody2D
Velocity Vector2
The UnityEngine.Rigidbody2D.velocity.
Inherited from CharacterBody2D
VerifyAvailableSpace bool
Enabling this adds a small performance cost to more reliably prevent the object from moving into areas where it doesn't quite fit. Otherwise attempting to move into such an area can cause it to jitter back and forth.

Methods

Name Value Summary
Awake() void
Initializes the PlatformerGameKit.Characters.CharacterBody2D.TerrainFilter.
FixedUpdate() void
OnCollisionEnter2D(Collision2D) void
OnCollisionStay2D(Collision2D) void
OnDisable() void
Sets PlatformerGameKit.Characters.CharacterBody2D.IsGrounded to false.
Inherited from CharacterBody2D
OnValidate() void
[Editor-Only] Ensures that all fields have valid values and finds missing components nearby.