- Home /
spawning position problem
Creating Asteroids using 3d assets, how do I spawn an object on the opposite site of the screen on the same trajectory after it leaves the screen/camera boundaries?
I'm creating a top down view asteroids game using 3d assets, the way they are being used is simply the X and Z axis. What I am struggling to comprehend is getting the asteroids and ship to spawn as they would in asteroids on the opposite side of the screen (or camera view) after they leave the boundries following the same trajectory as they were when they first left the screen.
I first tried with empty objects and colliders but that doesn't seem to be working. Any guidance in getting this to work would be very much appreciated.
An initial guess would be
if (objectX > screen.width){
objectX.transform.position = new Vector3(Screen.width - Screen.width, 0, objectX.transform.position.z);
}
But I probably wrong in this assumption.
An alternative would be to have indicators on the side of the screen pointing to the asteroids however, after looking at some examples of this the maths is very complicated for something that should be as simple as this.
Thanks,
Euden