CylinderCollider3D

Namespace:

namespace Lenga\Engine\Core;

class CylinderCollider3D

Properties

  • radius: sets the top and bottom radius to the same value.
  • topRadius: local radius of the top cap. Use 0.0 for cone-like shapes.
  • bottomRadius: local radius of the bottom cap.
  • height: local collider height.
  • offset: local offset from the GameObject transform.
  • isTrigger: detects overlap without producing a solid collision response.
  • materialPath: project-relative path to a Physics Material 3D asset.
  • material: a PhysicsMaterial3D object representing the collider material.

Methods

isTouching

public function isTouching(bool $includeTriggers = true, ?int $layerMask = null): bool

Returns true when this cylinder collider is touching another matching 3D collider.

Set $includeTriggers to false to ignore trigger contacts. Pass a $layerMask to limit the check to colliders on matching GameObject layers.

getContacts

public function getContacts(bool $includeTriggers = true, ?int $layerMask = null): array

Returns the current Collision3D contacts involving this cylinder collider.

Set $includeTriggers to false to return only solid contacts. Pass a $layerMask to limit results to matching GameObject layers.

Example

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\CylinderCollider3D;

final class PillarCollider extends Behaviour
{
    public function start(): void
    {
        $collider = $this->getComponent(CylinderCollider3D::class);
        $collider->radius = 0.5;
        $collider->height = 3.0;
    }
}