Class Ray_EX

Hierarchy

  • Ray
    • Ray_EX

Constructors

Properties

Methods

Constructors

  • Creates a new Ray instance. The ray is infinite, starting at a given origin and pointing in a given direction.

    Example

    // Create a new ray starting at the position of this entity and pointing down
    // the entity's negative Z axis
    var ray = new pc.Ray(this.entity.getPosition(), this.entity.forward);

    Parameters

    • Optional origin: Vec3

      The starting point of the ray. The constructor takes a reference of this parameter. Defaults to the origin (0, 0, 0).

    • Optional direction: Vec3

      The direction of the ray. The constructor takes a reference of this parameter. Defaults to a direction down the world negative Z axis (0, 0, -1).

    Returns Ray_EX

Properties

direction: Vec3

The direction of the ray.

origin: Vec3

The starting point of the ray.

Methods

  • 获得射线和指定三角形的交点

    Returns

    射线和三角形的交点

    Parameters

    • a: Vec3

      三角形a点坐标

    • b: Vec3

      三角形b点坐标

    • c: Vec3

      三角形c点坐标

    • backfaceCulling: boolean

      是否剔除背面

    • Optional res: Vec3

      交点(不传则创建新的向量)

    Returns Vec3

  • Sets origin and direction to the supplied vector values.

    Returns

    Self for chaining.

    Parameters

    • origin: Vec3

      The starting point of the ray.

    • direction: Vec3

      The direction of the ray.

    Returns Ray