Add insect surface-walker controller and mode

Add InsectController (transform-driven SphereCast surface following, no
CharacterController/Rigidbody, no gravity or slope limit) and InsectMode as a
third game mode. Wire it into GameModeManager with conditional registration so
PlayerControl and Insect modes only join the Tab cycle when their controller is
present. PaintMode/PlayerControlMode toggle the insect controller accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 4.8 committed 2026-06-24 07:27:17 +02:00
1 parent dbf5104611
commit cd40f42386
7 files changed
+405 -1

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
/// <summary>
/// Insect / surface-walk mode: the player crawls along any surface (walls, ceilings,
/// arbitrary slopes) via <see cref="InsectController"/>. The gravity-based
/// <see cref="PlayerCharacterController"/> is disabled so the two never fight. The
/// camera keeps its world-up orbit; painting is off.
/// </summary>
public class InsectMode : GameMode
{
public override string DisplayName => "Insect";
public override void Enter()
{
if (Manager.Player)
Manager.Player.enabled = false; // stop the gravity controller (its Update/gravity)
if (Manager.Insect)
{
Manager.Insect.enabled = true;
Manager.Insect.ControlEnabled = true;
Manager.Insect.SnapToSurface();
}
if (Manager.CameraInput)
Manager.CameraInput.LookMode = ThirdPersonOrbitInput.OrbitLookMode.AlwaysActive;
if (Manager.Painter)
Manager.Painter.PaintingEnabled = false;
}
public override void Exit()
{
if (Manager.Insect)
Manager.Insect.enabled = false;
if (Manager.Player)
Manager.Player.enabled = true;
}
}