r3-legacy/src/game-lib-d3-api-raycaster.js

47 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-12-15 14:53:39 +01:00
/**
* Raycaster for GameLib.D3
2017-01-09 15:20:48 +01:00
* @param id
* @param name
2016-12-15 14:53:39 +01:00
* @param position GameLib.API.Vector3
* @param direction GameLib.API.Vector3
2017-12-04 13:23:15 +01:00
* @param parentEntity
2016-12-15 14:53:39 +01:00
* @constructor
*/
GameLib.D3.API.Raycaster = function(
2017-01-09 15:20:48 +01:00
id,
name,
parentEntity,
2016-12-15 14:53:39 +01:00
position,
direction
2016-12-15 14:53:39 +01:00
) {
2017-01-09 15:20:48 +01:00
if (GameLib.Utils.UndefinedOrNull(id)) {
id = GameLib.Utils.RandomId();
}
this.id = id;
if (GameLib.Utils.UndefinedOrNull(name)) {
name = 'Raycaster (' + this.id + ')';
}
this.name = name;
2016-12-15 14:53:39 +01:00
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;
2017-12-04 13:23:15 +01:00
GameLib.API.Component.call(
this,
GameLib.Component.RAYCASTER,
parentEntity
);
2016-12-15 14:53:39 +01:00
};
2017-01-06 16:53:53 +01:00
2018-01-07 12:40:16 +01:00
GameLib.D3.API.Raycaster.prototype = Object.create(GameLib.API.Component.prototype);
2017-06-16 20:03:55 +02:00
GameLib.D3.API.Raycaster.prototype.constructor = GameLib.D3.API.Raycaster;