The wavetables (in the controls with the sliders), export two arrays that are set to custom values in each level. The first is an array of enum values that correspond to preset waveshapes (e.g. sine, cosine, saw, double sine, etc.). The second array is a set of amplitudes for those waves. The wavetable meshes are ArrayMesh objects that get re-built whenever those arrays are updated. There is some sigmoid-like interpolation that happens to smooth things out between the set wave shapes, but that gives the heights for the triangles along the mesh.
The selection offset (i.e. the slider value) then corresponds to a weight, potentially between two wave constraints. The control returns the selected wave as an array of heights, computed the same way the triangle heights are calculated, but with the custom offset.
The slope in the level is then provided a set of constraints, and is an ArrayMesh very similar to the wavetable meshes. To make sure everything lines up well, though, there are additional “flat” constraints at the top and bottom. In the later levels, the control constraints are combined depending on what’s called for by the level. The slope ArrayMesh is also converted into a trimesh shape (via Mesh.create_trimesh_shape()) whenever it’s updated to make sure the collisions are always accurate.
← Return to game
Comments
Log in with itch.io to leave a comment.
wow, cool concept. I'd love to hear how you implemented the waves.
Thank you! And happy to dig into it a little!
The wavetables (in the controls with the sliders), export two arrays that are set to custom values in each level. The first is an array of enum values that correspond to preset waveshapes (e.g. sine, cosine, saw, double sine, etc.). The second array is a set of amplitudes for those waves. The wavetable meshes are ArrayMesh objects that get re-built whenever those arrays are updated. There is some sigmoid-like interpolation that happens to smooth things out between the set wave shapes, but that gives the heights for the triangles along the mesh.
The selection offset (i.e. the slider value) then corresponds to a weight, potentially between two wave constraints. The control returns the selected wave as an array of heights, computed the same way the triangle heights are calculated, but with the custom offset.
The slope in the level is then provided a set of constraints, and is an ArrayMesh very similar to the wavetable meshes. To make sure everything lines up well, though, there are additional “flat” constraints at the top and bottom. In the later levels, the control constraints are combined depending on what’s called for by the level. The slope ArrayMesh is also converted into a trimesh shape (via
Mesh.create_trimesh_shape()
) whenever it’s updated to make sure the collisions are always accurate.Hope that makes sense. Thanks for the interest!
Very cool, thanks for the explanation. Now I see the 2D view of the 3D waves, and the line is a straight line projected on it. So smart.
This is so cool
Thank you! It was a lot of fun to figure out!