WallCheck

February 9, 2024 ยท View on GitHub

Namespace: Unity.TinyCharacterController.Check


Summary:

WallCheck is a component that performs collision detection with walls. It detects walls in the character's movement direction and triggers multiple Unity Events upon collision with a wall.

Features and Operation:

  • Wall Collision Detection: Detects walls in the character's movement direction and determines if there is contact.
  • Collision Callbacks: Triggers multiple Unity Events upon collision with a wall.

Properties

NameDescription
_wallAngleRangeThe range of angles recognized as a wall.
_wallDetectionDistanceDistance for wall detection.
OnWallContactedEvent triggered when contacting a wall.
OnWallLeftEvent triggered when leaving a wall.
OnWallStuckEvent triggered while in contact with a wall.
IsContactIndicates whether there is contact with a wall.
NormalThe normal vector of the contact surface.
ContactObjectThe object that was contacted.
HitPointThe point of contact.

Methods

NameFunction
public bool HitCheck( Vector3 direction, out Vector3 normal, out Vector3 point, out Collider contactCollider )Performs wall detection in the specified direction, returning the normal, contact point, and contacted object if contact is made.