diff --git a/src/game-lib-component-entity-parent.js b/src/game-lib-component-entity-parent.js index 0706dbc..67a2a80 100644 --- a/src/game-lib-component-entity-parent.js +++ b/src/game-lib-component-entity-parent.js @@ -1,8 +1,9 @@ /** * - * @param id - * @param name - * @param parent + * @param id {String} + * @param name {String} + * @param parent {GameLib.D3.Entity} + * @param centerToOrigin {Boolean} * @constructor */ GameLib.D3.ComponentEntityParent = function ComponentEntityParent( diff --git a/src/game-lib-component-entity-permutation.js b/src/game-lib-component-entity-permutation.js index 4484411..49a751a 100644 --- a/src/game-lib-component-entity-permutation.js +++ b/src/game-lib-component-entity-permutation.js @@ -34,7 +34,7 @@ GameLib.D3.ComponentEntityPermutation = function ComponentEntityPermutation( if(GameLib.D3.Utils.UndefinedOrNull(scaleOffset)) { - scaleOffset = new GameLib.D3.Vector3(0, 0, 0); + scaleOffset = new GameLib.D3.Vector3(1, 1, 1); } this.scaleOffset = scaleOffset; GameLib.D3.Utils.Extend(GameLib.D3.ComponentEntityPermutation, GameLib.D3.ComponentInterface); @@ -71,7 +71,7 @@ GameLib.D3.ComponentEntityPermutation.prototype.onUpdate = function( ComponentEntityPermutation_scale.copy(parentEntity.scale); ComponentEntityPermutation_offsetScale.copy(this.scaleOffset); - ComponentEntityPermutation_scale = ComponentEntityPermutation_scale.add(ComponentEntityPermutation_offsetScale); + ComponentEntityPermutation_scale = ComponentEntityPermutation_scale.multiply(ComponentEntityPermutation_offsetScale); parentEntity.position.x = ComponentEntityPermutation_position.x; parentEntity.position.y = ComponentEntityPermutation_position.y; diff --git a/src/game-lib-component-mesh-permutation.js b/src/game-lib-component-mesh-permutation.js index bc1740d..fb5502b 100644 --- a/src/game-lib-component-mesh-permutation.js +++ b/src/game-lib-component-mesh-permutation.js @@ -25,7 +25,7 @@ GameLib.D3.ComponentMeshPermutation = function ComponentMeshPermutation( this.positionOffset = positionOffset || new GameLib.D3.Vector3(0, 0, 0); this.quaternionOffset = quaternionOffset || new GameLib.D3.Vector4(0, 0, 0, 1); - this.scaleOffset = scaleOffset || new GameLib.D3.Vector3(0, 0, 0); + this.scaleOffset = scaleOffset || new GameLib.D3.Vector3(1, 1, 1); // Todo: this should be executed somewhere in game-lib-z, so that we don't execute it on every construction of an object. GameLib.D3.Utils.Extend(GameLib.D3.ComponentMeshPermutation, GameLib.D3.ComponentInterface); @@ -62,7 +62,7 @@ GameLib.D3.ComponentMeshPermutation.prototype.onLateUpdate = function( ComponentMeshPermutation_scale.copy(parentEntity.mesh.scale); ComponentMeshPermutation_offsetScale.copy(this.scaleOffset); - ComponentMeshPermutation_scale = ComponentMeshPermutation_scale.add(ComponentMeshPermutation_offsetScale); + ComponentMeshPermutation_scale = ComponentMeshPermutation_scale.multiply(ComponentMeshPermutation_offsetScale); parentEntity.mesh.position.copy(ComponentMeshPermutation_position); parentEntity.mesh.quaternion.copy(ComponentMeshPermutation_quaternion); diff --git a/src/game-lib-component-offsettor.js b/src/game-lib-component-offsettor.js index c449854..c7e0a87 100644 --- a/src/game-lib-component-offsettor.js +++ b/src/game-lib-component-offsettor.js @@ -3,8 +3,8 @@ * @param id * @param name * @param axis {GameLib.D3.Vector3} - * @param getOffsetFunc - * @param userData + * @param getOffsetFunc {function} + * @param userData {Object} * @constructor */ GameLib.D3.ComponentOffsettor = function ComponentOffsettor( @@ -23,7 +23,9 @@ GameLib.D3.ComponentOffsettor = function ComponentOffsettor( this.parentEntity = null; this.axis = axis || new GameLib.D3.Vector3(); - this.getOffsetFunc = getOffsetFunc || function(entity, component, userData){ return 1; }; + this.offset = 1; + var component = this; + this.getOffsetFunc = getOffsetFunc || function(entity, component, userData){ return component.offset; }; this.userData = userData; GameLib.D3.Utils.Extend(GameLib.D3.ComponentOffsettor, GameLib.D3.ComponentInterface); diff --git a/src/game-lib-component-path-controls.js b/src/game-lib-component-path-controls.js index 54ce11c..80aa98c 100644 --- a/src/game-lib-component-path-controls.js +++ b/src/game-lib-component-path-controls.js @@ -39,7 +39,8 @@ GameLib.D3.ComponentPathControls.prototype.onUpdate = function( if (this.keyForwardPressed) { // Forward [i] this.pathFollowingComponent.direction = 1; } else if (this.keyBackPressed){ - this.pathFollowingComponent.direction = -1; + this.pathFollowingComponent.direction = 0; + // this.pathFollowingComponent.direction = -1; } else { this.pathFollowingComponent.direction = 0; } diff --git a/src/game-lib-component-rotator.js b/src/game-lib-component-rotator.js index 288a65f..69f6d3b 100644 --- a/src/game-lib-component-rotator.js +++ b/src/game-lib-component-rotator.js @@ -3,7 +3,8 @@ * @param id * @param name * @param axis {GameLib.D3.Vector3} - * @param getRotationFunc {Number} + * @param getRotationFunc {Function} + * @param userData {Object} * @constructor */ GameLib.D3.ComponentRotator = function ComponentRotator( @@ -21,8 +22,10 @@ GameLib.D3.ComponentRotator = function ComponentRotator( this.name = name; this.parentEntity = null; + this.rotation = 0; + var component = this; this.axis = axis || new GameLib.D3.Vector3(); - this.getRotationFunc = getRotationFunc || function(entity, component, userData){ return 1; }; + this.getRotationFunc = getRotationFunc || function(entity, component, userData){ return component.rotation; }; this.userData = userData; GameLib.D3.Utils.Extend(GameLib.D3.ComponentRotator, GameLib.D3.ComponentInterface);