engine icon indicating copy to clipboard operation
engine copied to clipboard

Raycast hitResult return collidershape

Open JujieX opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe.

raycast HitResult returns collider shape useful when the entity have multiple collider shapes

    const { inputManager } = this.engine;
    const ray = new Ray();
    const hit = new HitResult();
    this.camera.screenPointToRay(inputManager.pointerPosition, ray);
    const result = engine.physicsManager.raycast(
      ray,
      Number.MAX_VALUE,
      Layer.Everything,
      hit
    );
    if (result) {
      console.log(hit);
    }
  }

HitResult2 {entity: Entity2, distance: 16.806891631390485, point: Vector32, normal: Vector32, shape:colliderShape}

JujieX avatar Sep 02 '22 10:09 JujieX