forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathray.js
More file actions
23 lines (22 loc) · 981 Bytes
/
ray.js
File metadata and controls
23 lines (22 loc) · 981 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pc.extend(pc, function () {
/**
* @name pc.Ray
* @class An infinite ray
* @description Creates a new infinite ray 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);
* @param {pc.Vec3} [origin] The starting point of the ray. The constructor takes a reference of this parameter.
* Defaults to the origin (0, 0, 0).
* @param {pc.Vec3} [direction] 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).
*/
var Ray = function Ray(origin, direction) {
this.origin = origin || new pc.Vec3(0, 0, 0);
this.direction = direction || new pc.Vec3(0, 0, -1);
};
return {
Ray: Ray
};
}());