/** * This component makes the parentEntity (ex. car) follow the path provided by the spline * @param graphics GameLib.D3.Graphics * @param parentObject * @param apiPathFollowing GameLib.D3.API.PathFollowing * @constructor */ GameLib.D3.PathFollowing = function RuntimePathFollowing( graphics, parentObject, apiPathFollowing ) { this.graphics = graphics; this.graphics.isNotThreeThrow(); if (GameLib.Utils.UndefinedOrNull(parentObject)) { parentObject = null; } this.parentObject = parentObject; GameLib.D3.API.PathFollowing.call( this, apiPathFollowing.id, apiPathFollowing.name, apiPathFollowing.spline, apiPathFollowing.raytraceMesh, apiPathFollowing.accelleration, apiPathFollowing.maxSpeed, apiPathFollowing.baseOffset, apiPathFollowing.maxOffset, apiPathFollowing.steeringSpeed, apiPathFollowing.targetOffset, apiPathFollowing.currentOffset, apiPathFollowing.currentPathValue, apiPathFollowing.currentSpeed, apiPathFollowing.direction, apiPathFollowing.mx, apiPathFollowing.my, apiPathFollowing.mz, apiPathFollowing.raycaster, apiPathFollowing.currentPosition, apiPathFollowing.futurePosition, apiPathFollowing.up, apiPathFollowing.rotationMatrix, apiPathFollowing.rotationVector ); this.baseOffset = new GameLib.Vector3( this.graphics, this, this.baseOffset ); this.maxOffset = new GameLib.Vector3( this.graphics, this, this.maxOffset ); this.targetOffset = new GameLib.Vector3( this.graphics, this, this.targetOffset ); this.currentOffset = new GameLib.Vector3( this.graphics, this, this.currentOffset ); this.raycaster = new GameLib.D3.Raycaster( this.graphics, this, this.raycaster ); this.currentPosition = new GameLib.Vector3( this.graphics, this, this.currentPosition ); this.futurePosition = new GameLib.Vector3( this.graphics, this, this.futurePosition ); this.up = new GameLib.Vector3( this.graphics, this, this.up ); this.rotationMatrix = new GameLib.Matrix4( this.graphics, this, this.rotationMatrix ); this.rotationVector = new GameLib.Quaternion( this.graphics, this, this.rotationVector ); }; GameLib.D3.PathFollowing.prototype = Object.create(GameLib.D3.API.PathFollowing.prototype); GameLib.D3.PathFollowing.prototype.constructor = GameLib.D3.PathFollowing;