Collision3D
Namespace:
namespace Lenga\Engine\Core;
class Collision3D
Methods
fromNativeData
public static function fromNativeData(array $data)
Properties
gameObject
public ?GameObject $gameObject { get; }
The GameObject that contacted the callback receiver.
collider
public ?Component $collider { get; }
The collider that contacted the callback receiver.
selfGameObject
public ?GameObject $selfGameObject { get; }
The GameObject that received the callback.
selfCollider
public ?Component $selfCollider { get; }
The receiver-side collider involved in the contact.
otherGameObject and otherCollider
These remain available as aliases for the contacted object and collider.
Example
use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\Collision3D;
class ExplosiveObject extends Behaviour
{
public function onCollisionEnter(Collision3D $collision): void
{
Debug::log('Touched by: ' . $collision->gameObject?->name);
$this->explode();
}
private function explode(): void
{
}
}