• News

• Industries

• Learning & Support

• Community

• Marketplace

# Help needed for Spawnpoint algoritm / vector math question

I hope somebody is able to understand my question first of all see the following image:

I want to ‘calculate’ the positions 1,2,3,etc… via blueprint. Parameters are SpawnPoint A (location vector3) and Target (Player).

I was experimenting with ‘find lookat rotation’ and somehow could get a object to spawn at the locations 1 and face the player but the next object should be spawned on 2 and 3 and if needed 4…5.6… etc but I don’t know how to calculate that positions.

Any hints and or tips would be appreciated!! thanks in advance.

Take the spawnpoint vector and subtract the player vector, normalize that vector. Take the normalized vector and multiply by a float that’s how much distance you want between that object and the spawnpoint object, add that vector to the spawnpointA vector, and set your object at that vector. If you loop through the multiply( increasing multiply by that amount each time.) and add spawnpointA you will get them to spawn in a line.

VectorA-VectorP=VectorN
Loop int I = 1 to N
VectorN*(FloatM+I) = VectorD
VectorD+VectorA = FinalVector
spawnObject at FinalVector

I didn’t try this but the basic idea should work.

Thanks for the quick reply!! I’m at work right now but will try this later today when i’m home.