47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
/**
|
|
* Raycaster for GameLib.D3
|
|
* @param id
|
|
* @param name
|
|
* @param position GameLib.API.Vector3
|
|
* @param direction GameLib.API.Vector3
|
|
* @param parentEntity
|
|
* @constructor
|
|
*/
|
|
GameLib.D3.API.Raycaster = function(
|
|
id,
|
|
name,
|
|
parentEntity,
|
|
position,
|
|
direction
|
|
) {
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(id)) {
|
|
id = GameLib.Utils.RandomId();
|
|
}
|
|
this.id = id;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
|
name = 'Raycaster (' + this.id + ')';
|
|
}
|
|
this.name = name;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(position)) {
|
|
position = new GameLib.API.Vector3();
|
|
}
|
|
this.position = position;
|
|
|
|
if (GameLib.Utils.UndefinedOrNull(direction)) {
|
|
direction = new GameLib.API.Vector3(0, -1, 0);
|
|
}
|
|
this.direction = direction;
|
|
|
|
GameLib.API.Component.call(
|
|
this,
|
|
GameLib.Component.RAYCASTER,
|
|
parentEntity
|
|
);
|
|
};
|
|
|
|
GameLib.D3.API.Raycaster.prototype = Object.create(GameLib.API.Component.prototype);
|
|
GameLib.D3.API.Raycaster.prototype.constructor = GameLib.D3.API.Raycaster;
|