- Layered State Machine Architecture: Developed a multi-layered state system separating movement physics, input logic, and animation into independent layers. Enables consistent behavior across radically different traversal contexts.
- Context-Driven Input System: Created a flexible input framework where actions dynamically adapt to gameplay context, eliminating hardcoded branching.
Snippet: Exposing native, pointer-safe vector math via a Blueprint Function Library.
void UPlanetMathLibrary::RelativePlanetOrientation(UCharacterMovementComponent* MovementComp, USceneComponent* Capsule, USceneComponent* Mesh, float DeltaTime, float RotationSpeed)
{
// Safety check
if (!MovementComp || !Capsule || !Mesh) return;
FVector Accel = MovementComp->GetCurrentAcceleration();
FVector UpVector = Capsule->GetUpVector();
// Project acceleration onto the planetary tangent plane
FVector PlaneAccel = FVector::VectorPlaneProject(Accel, UpVector);
if (PlaneAccel.IsNearlyZero(0.1f)) return;
PlaneAccel.Normalize();
FQuat TargetQuat = FRotationMatrix::MakeFromXZ(PlaneAccel, UpVector).ToQuat();
FQuat CurrentQuat = Mesh->GetComponentQuat();
// Smooth spherical interpolation
FQuat SmoothQuat = FMath::QInterpTo(CurrentQuat, TargetQuat, DeltaTime, RotationSpeed);
Mesh->SetWorldRotation(SmoothQuat);
}
Blueprint Integration: Planetary Locomotion Flow
By exposing native math to the Blueprint VM, designers hook up Enhanced Input Actions to custom traversal logic without sacrificing runtime performance.
1. Input Layer:
Enhanced Input: IA_MoveWalk
➔
Clear Jump State
2. Native Execution:
ƒ Relative Planet Movement (C++)
➔
ƒ Relative Planet Orientation (C++)