I’m trying to translate a vector and then apply that to the mesh.position instead of working directly on the mesh but am having some trouble.
What works is:
// during setup
this.posStart = this.plane.position.clone();
// this is in the render loop
this.plane.position = this.posStart;
this.plane.locallyTranslate(new Vector3(0, 0, z));
// Result is moving from a fixed position and not incrementing on movement
Issue is I don’t want to have to set the position of the plane to posStart every time and instead work with a vector and then only apply that position to the mesh once it’s been calculated. Something like:
// during setup
var posStart = this.plane.position.clone();
// this happens in render loop
var newPos = this.posStart.clone();
newPos.translate(Axis.Y,2,Space.WORLD); // ERROR: newPos.translate is not a function
this.plane.position = newPos;
Will translate the mesh/plane in the direction it is facing, in relation to it’s parent space (which vector3 is not aware of), not to mention locallyTranslate is not a method on vector3.
What would the best way be to modify/translate a vector3 to move towards another vector3 (I am modifying the plane to move to vector3(0,0,0)).