Download

Really Strange Behavior in Looping Terrain Treadmill Code

So I have a StaticMeshComponent that has two arrays of subobject StaticMeshComponents and iterates over them, moving them forward by movementSpeed * deltaTime every tick, then checking if their distance (stored in an array the size of subobjectArray.count) over separation (user entered variable that specifies how much space to put between copies of this object), and then subtracting the amount of the subobjects from one array (they both have the same amount of subobjects) multiplied by the separation from that position. However, instead, half of the subobjects just accelerates off into neverland, while the other half stay, even though both positions are updated to the same value. I can’t figure out why this is happening.

Here’s my code:
KillerCube.h - http://pastebin.com/Sqm7nrQj
KillerCube.cpp - http://pastebin.com/V1uJ47Xv