Constructors

Accessors

  • get raycasting(): boolean
  • Returns true if raycasting is currently happening

    Returns boolean

Methods

  • raycast against rendered three objects. This might be very slow depending on your scene complexity. We recommend setting objects to IgnoreRaycast layer (2) when you don't need them to be raycasted. Raycasting SkinnedMeshes is specially expensive. Use raycastPhysics for raycasting against physic colliders only. Depending on your scenario this might be faster.

    Parameters

    • options: IRaycastOptions = null

      raycast options. If null, default options will be used.

    Returns Intersection<Object3D<Object3DEventMap>>[]

  • Parameters

    • ray: Ray
    • options: IRaycastOptions = null

    Returns Intersection<Object3D<Object3DEventMap>>[]

  • Parameters

    • origin: Vec3 | Vec2
    • direction: Vec3 = undefined
    • maxDistance: number = Infinity
    • solid: boolean = true

    Returns {
        collider: ICollider;
        normal?: Vector3;
        point: Vector3;
    }

    Deprecated

    use this.context.physics.engine.raycast IPhysicsEngine.raycast

  • Parameters

    • origin: Vec3 | Vec2
    • direction: Vec3 = undefined
    • maxDistance: number = Infinity
    • solid: boolean = true

    Returns {
        collider: ICollider;
        normal?: Vector3;
        point: Vector3;
    }

    Deprecated

    use this.context.physics.engine.raycastAndGetNormal IPhysicsEngine.raycastAndGetNormal

  • Test overlapping of a sphere with the threejs geometry. This does not use colliders. This does not return an exact intersection point (intersections returned contain the object and the world position of the object that is being hit) For a more accurate test use the physics engine's collider overlap test (see sphereOverlapPhysics)

    Parameters

    • spherePos: Vector3

      the center of the sphere in world space

    • radius: number

      the radius of the sphere

    • traverseChildsAfterHit: boolean = true

      if false it will stop after the first hit. If true it will continue to traverse and add all hits to the result array

    • bvh: boolean = false

      use MeshBVH for raycasting. This is faster than the default threejs raycaster but uses more memory.

    • shouldRaycast: RaycastTestObjectCallback = null

      optional callback to filter objects. Return false to ignore the object completely or "continue in children" to skip the object but continue to traverse its children (if you do raycast with recursive enabled)

    Returns Intersection<Object3D<Object3DEventMap>>[]

Generated using TypeDoc