Constructor
new Ray(originopt, directionopt)
Creates a new infinite ray starting at a given origin and pointing in a given direction.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
origin |
pc.Vec3 |
<optional> |
The starting point of the ray. The constructor takes a reference of this parameter. Defaults to the origin (0, 0, 0). |
direction |
pc.Vec3 |
<optional> |
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). |
- Source:
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);