Custom Spawnpoint

Hello,

I am not sure if this can be done without access to source code.

I want to make a custom Spawnpoint that starts out has a circle when you drop it into the level. But also let the level designer change it’s shape like making the circle into an arc and the enemy will spawn from the area of the arc.(am not is this can be done with C# on the scripting side).

Could someone point me in the right direction to do this?

THat requires maath lol. You would need to get into a lot of polygon math in order to define custom shapes for your spawning “area”

A simple solution would be way easier, you just need to make a vector3 variable :slight_smile: That variable represents the “center” of spawning, and can be edited however you like, through drag in drop, runtime, etc etc. Then you have a radius vairable. Basically, enemies can spawn anywhere within a certain radius of the spawnpoint. How do you do this? You would calculate, for any spawning, the position of where to spawn the enemy, like so:

c#:

public void spawnAnEnemy(Vector3 where, float radius)
{
Vector2 offset = Random.insideUnitCircle * radius;
Vector3 truewhere = where;
truewhere.x += offset.x;
truewhere.y += offset.y;
//Spawn enemy at truewhere.
}

JS:

function spawnAnEnemy(where : Vector3, radius : float)
{
var offset : Vector2 = Random.insideUnitCircle * radius;
var truewhere : Vector3 = where;
truewhere.x += offset.x;
truewhere.y += offset.y;
//Spawn enemy at truewhere.
}