In a previous post I talked about how whole-body locomotion could be performed on void-sponge fractals using Mobius transformations. Since then I have made this Shadertoy game to try out how well the control techniques work.
Before getting into the control system I'll recap what is happening here. The controllable player is a 3D conformal-type. A conformal-type is the equivalence class of points under conformal symmetries, which in 3D are the 3D Mobius transformations. So unlike a shape, this is natively non-rigid; it flexes.
The particular conformal-type in question is a void-sponge, built as the inversive limit set of 16 generating spheres in 4D centred on the vertices of an 8-cell and projected stereographically into 3D. You can use the vertices of other 4D polytopes too, like the 5-cell, 16-cell, 24-cell, 120-cell and 600-cell but the 8-cell is particularly convenient for keyboard control as it has right-angled symmetry.
So there are two parts to this study of control techniques. The first is how you can use the Mobius transformations to locomote the object in various environments, and the second is how you can use keyboard control efficiently to do so.
1. Physical Locomotion
The go-to Mobius transformation here is the elliptic transformation, also called circulation. As previously shown, this allows swimming through water, and flying. On ground, circulation is applied more carefully. A small amount of circulation around a vertically oriented circle will tip the sponge in the normal direction of the circle's plane.
In fact I found that the circle needs to be tipped slightly downwards at first, then tend to horizontal as the sponge gains speed and 'walks' across the landscape. The sponge seems to be able to climb up to 13% slopes with this circulation method.
2. Keyboard Control
The 8-cell sponge supports an intuitive and efficient form of keyboard control, entirely with the four arrow keys and the A/Z keys for vertical motion. The camera finds the closest principle axes (with pitch/roll removed) on the sponge to the camera's current orientation and converges towards a chosen orientation close to this axis, typically looking slightly down on the sponge.
A: Swimming
The desired velocity vector for the left/right/up/down arrows are left/right/forwards/backwards on these closest principle axes. Similarly for the A/Z keys it is the up/down of the closest principle axes. Consequently the controls are approximately screen-space; you press left, the sponge moves left.
These 6 principle desired velocity vectors are quite crude on their own, so we support a secondary key press. Whatever direction you hold down the orthogonal four keys can then be pressed to tilt the desired velocity in the that direction. For instance, if you hold A to go up, then press the left arrow, the desired velocity will point up and a little to the left.
We then need a feedback controller that can rotate the body to match the tilt, and circulate the body to acheive the desired velocity. A simple PD controller is used, which adds a small amount of lateral circulation to compensate for the angular and angular velocity error of the sponge relative to the desired velocity vector's angle.
For upwards swimming this gives four tilt directions and the untilted direction, so five for each of the 6 principle swim directions, giving a total of 30 swimming directions. Note that for the horizontal swim directions, pressing an orthogonal horizontal direction yaws the sponge, which causes the camera to rotate accordingly, as a result this horizontal control is not a tilt but a curved path, it is steering the swimming.
B. Surface Swimming
If you swim laterally and press A as the secondary key then the sponge will eventually reach the surface, where the lack of drag on its top half will pitch it upwards. The feedback controller (if strong enough) modifies the 'stroke' to be shorter movements at the base to compensate for this pitch. The result is a surface swimming motion. I am not sure if this is the best way to surface swim with this conformal-type but it may well be.
C. Flying
Flying is quite similar to swimming, but only uses the upwards A key as the main direction. The motion is also faster to account for the lower drag of air compared to water. You can therefore press and hold A to begin circulating the sponge vertically, and then press the arrow keys to tilt the sponge and so fly in the respective lateral direction.
Unlike swimming you reach a maximum height and so move laterally even when holding A. You can only descend by stopping holding A.
D. Walking
The 'walking' uses a slight circulation of the sponge in the walk direction (arrow keys) to bend the sponge to repeatedly tip in that direction. As with the swimming you can press an orthogonal horizontal direction while your main direction is held, which turns the sponge, steering it in a circular path. It also supports the A/Z secondary direction, which tilts the circulation up and down. This can help in some cases such as getting started but is mainly there just for consistency.
You can see the simulated walking movement
here.
E. Crouching
The Z key on its own currently just circulates the sponge down slightly, which is like a crouch.
The control is nicely consistent across all three mediums, with the secondary key allowing steering on top of the main movement direction. There are a few motions that I haven't programmed but would be interesting to try in future:
i. Jumping
For a standing jump pressing Z (crouch) and then A could work it made strong enough, but bumps on the ground may always make that problematic. It also would make flight more realistic if the sponge had to jump first.
For a walking jump, pressing Z as the secondary key and then A might work similarly.
ii. Digging:
The controls of digging can be the same as swimming. The primary key is the digging direction and the secondary key steers, with yaw being a continuous angle change and pitch and roll being a fixed tilt.
The only thing that is different is that it uses a parabolic rather than elliptic Mobius transformation.
iii. Rolling
The first difficulty with rolling is to get the sponge into the right configuration at the right angle. The main idea for rolling forwards is: hold left key, then right key to tip onto edge. both pressed triggers it to form the wheel shape.
At this point, if the wheel is on a slope then it will start to roll down it. We use changes to the circulation vector to auto-balance the wheel while both keys are held down. If it is not on a slope then forward and back arrows can adjust the circulation vector to weight the wheel forwards or backwards.
Finally it may be possible to lift the left or right keys individually to steer the wheel as it rolls.
Summary
Unlike shapes, conformal-types are flexible and their range of motion allows for multiple forms of locomotion. For the 8-cell based sponge this seems to be particularly amenable to keyboard control where just the arrow keys plus A/Z allow a wide variety of motion and steering that is more-or-less the same regardless of medium: air, ground, water, underground. So this has plenty of potential as a game character or vehicle.
The main area that requires a bit more complexity would be rolling locomotion.