Being new to three.js, I am facing a challenge with translating an object imported from Maya. The issue arises after rotating the object; when I attempt to move it afterward, it moves along the scene's axis instead of in the direction of the rotation.
This is my attempted solution:
var keyCode = event.which;
// up
if (keyCode == 87) {
shuttle.translateZ(0.2);
// down
} else if (keyCode == 83) {
shuttle.translateZ(-0.2);
// left
} else if (keyCode == 65) {
shuttle.rotation.y-= 0.1;
// right
} else if (keyCode == 68) {
shuttle.rotation.y += 0.1;
}
Interestingly, whether I use the function translateZ or shuttle.position.z+=1, there seems to be no difference in the outcome.