so confused about it
Not entirely clear what you need help with.
Here is some pseudo-code to calculate spawn positions, which may or may not be the thing you need help with
Axis Aligned (+Y is north):
North Spawn Pos: BlueCube.Location + Vector(0, 1, 0) * ( BlueCube.Width / 2 + RedCube.Width / 2 );
East Spawn Pos: BlueCube.Location + Vector(1, 0, 0) * ( BlueCube.Width / 2 + RedCube.Width / 2 );
South Spawn Pos: BlueCube.Location + Vector(0, -1, 0) * ( BlueCube.Width / 2 + RedCube.Width / 2 );
West Spawn Pos: BlueCube.Location + Vector(-1, 0, 0) * ( BlueCube.Width / 2 + RedCube.Width / 2 );
BlueCube Aligned (BlueCube facing is ‘North’):
'North' Spawn Pos: BlueCube.Location + BlueCube.ForwardVector * ( BlueCube.Width / 2 + RedCube.Width / 2 );
'East' Spawn Pos: BlueCube.Location + BlueCube.RightVector * ( BlueCube.Width / 2 + RedCube.Width / 2 );
'South' Spawn Pos: BlueCube.Location + BlueCube.ForwardVector * -1 * ( BlueCube.Width / 2 + RedCube.Width / 2 );
'West' Spawn Pos: BlueCube.Location + BlueCube.RightVector * -1 * ( BlueCube.Width / 2 + RedCube.Width / 2 );
* RedCubes would need to be spawned with same rotation as the BlueCube to get the no overlap thing in this version.
If the cubes are the same dimensions, these can obviously be simplified.
1 Like