Shooting projectiles from two synchronised points

Hi! I’m starting with unity on a small project but i cant figure out a spawning script. Please help! Thank you :slight_smile:

I’m trying to shoot a projectile from left to right, and from top to bottom, each on a straight path from the spawn point through a bridge controlled by the user who can turn the platform to connect ends of the bridge to the ground letting the projectile pass. if the bridge will be in a wrong position the projectile will explode.

the challenge i have is in making the spawner to spawn randomlly from left to right or from top to bottom because for that it has to move between two points

can you help me figure out the script?

thank you :slight_smile:

If your two end points are called pointA and pointB, then a random point between them is:

Vector3 spawnPt = Vector3.Lerp(pointA, pointB, Random.Range(0f, 1f);