Download

spawn platforms randomly

Hi there,
it’s me again with some trouble we have on programming our endless runner game. Again it’s the first time we dig into the UE4 and the blueprints.
Our idea is to spawn 10 platforms at the beginning. After activating their triggers, we delete the last and add a new platform. This concept worked fine till we tried to spawn 2 different platforms randomly.

This is how we spawn our platforms. I debugged the value of LastPlatformPosition, it’s correct calculated.
8459a6625586aef9b47d106b4af64c0a50fdbd86.jpeg

When I ran the game, the platforms aren’t placed how they should be…
e98dccbd6c28ee01d8bdc4c95c4aa283e9d3ff12.jpeg
9a25e9f6002182c7a1140bb6280ded7c35e24cee.jpeg

They overlap for some reason we coulnd’t figure out yet.
Do you have any idea how to fix this problem?

rgds
_basteln

I believe you need to add the length of your last platform, not the length of the new one. If you make a variable for Last Platform Length, and one for Current Platform Length, that should sort things out.

Oh, that’s right. Thanks a lot! :slight_smile: