Hi, here is the first working version of the prototype using GPU instancing. Wireframe and glow are not working on the tunnel yet.
SPACE = Toggle settings
You can create your own enemy by editing the
enemyMatrix. I created two materials for the enemy,
R means use red solid block,
O means white wireframe and finally
_ means empty space.
const enemyMatrix = [ [R, _, O, _, _, _, _, _, O, _, R], [_, _, _, O, _, _, _, O, _, _, _], [_, _, O, O, O, O, O, O, O, _, _], [_, O, O, R, O, O, O, R, O, O, _], [O, O, O, O, O, O, O, O, O, O, O], [O, _, O, O, O, O, O, O, O, _, O], [O, _, O, _, _, _, _, _, O, _, O], [_, _, _, O, R, _, R, O, _, _, _] ]
console.log your current settings by pressing
+. Each keypress creates a keyframe. Create as many as you wish, copy out the final json object, replace the
pathData variable value at the start of the script. Chane
processPath(false) to disable randomizing the path in play mode and use the
pathData variable instead.
You might want to change the
animationLength at line
26 to whatever value you want. It is basically the time between two keyframes. The
pathData contains the distance when the keyframe was recorded, so the code can be modified to use dynamic
Some very satisfying numbers: