Hi,
I’m trying to work out how to get Object Repeat on X & Z (if that’s the right description) to work. EG: In 2D / fixed camera it works like so
This works fine if I move the FreeCamera in the X and Z directions only and only when at angles 0, 90, 180, 270.
However if I rotate the camera to something inbetween I get a not suprising result, like so:
At first I move on Z - and + then I rotate camera by 90 deg and move in X +/-, then I rotate to something inbetween 0,90,180,270.
My code:
let xDist = this.gallery.camera.position.x - this.item.position.x;
let zDist = this.gallery.camera.position.z - this.item.position.z;
// This will only for fixed camera and motion in x and z only
// I need FreeCamera (1st person camera) motion in x and z only
// I will be locking y to a min and max value limit.
if (xDist < -100){
this.item.position.x = this.gallery.camera.position.x - 99;
}
if (xDist > 100){
this.item.position.x = this.gallery.camera.position.x + 99;
}
if (zDist < -100){
this.item.position.z = this.gallery.camera.position.z - 99;
}
if (zDist > 100){
this.item.position.z = this.gallery.camera.position.z + 99;
}
I think this should be adding the camera’s rotation to the objects new position and using the camera as a centerpoint for that rotation…?
Any ideas…?
