Using a temporary variable, I initialize a THREE.Vector3 which is then passed into the creation of an object.
object[i] = new Object(new THREE.Vector3(0,0,0));
Within the Object class, there is a variable called texture that gets assigned the new THREE.Vector3 named pos.
function Object(pos){
this.texture = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { map:
THREE.ImageUtils.loadTexture( '../img/img.png' ) } ) );
this.texture.position = pos;
this.texture.rotation.x = 0;
this.texture.rotation.y = 1.57;
this.texture.rotation.z = 1.57;
this.texture.scale.x = 100;
this.texture.scale.y = 50;
this.texture.scale.z = 100;
this.texture.position.y = 1000;
}
The issue arises when trying to pass pos into another object created within this Object.
object2 = new Object2(pos);
The problem is that pos has been altered to have y-coordinate set at 1000. The reason behind this modification is unclear and after going through some guides on passing variables, confusion still remains regarding the alteration of the pos variable. Any assistance in resolving this matter would be greatly appreciated.