GameCrew AIEarly access
Sign in
Unity 6VRRevision 1 · Compile-verified pattern

Physical Arm-Push VR Locomotion, Wall-Climbing & Surface Vaulting in Unity 6

Updated

Tactile hand-to-surface VR locomotion in Unity 6 using CCGD.GameXR: non-penetrating sphere-cast hand contacts, play-space velocity launch impulses, wall climbing and vaulting, haptic slap feedback, and full desktop/mobile fallback.

  • vr
  • xr
  • locomotion
  • arm-push
  • climbing
  • vault
  • momentum
  • gorilla
  • hands
  • physics
  • haptics
  • comfort
  • quest

No demo.

When to Use (and When Not To)

Use physical arm-push locomotion for playful VR climbing, tag/chase, jungle canopy, parkour, and zero-joystick movement games where players slap the floor, walls, branches, or ledges with their hands to propel, bounce, and climb.

Skip arm-push locomotion for seated puzzle workbenches, precision aiming ranges, or cozy viewing experiences where standard comfort teleport and snap-turn (vr-interactions-ergonomics) are less tiring. Always pair arm-push VR movement with a responsive flat-screen controller (WASD + Space jump + mouse look) so desktop and mobile players can play the exact same rooms without a headset.

Mathematical & Algorithmic Core

Each hand maintains a physical contact anchor c_h separate from the raw tracked hand t_h:

  1. Non-Penetrating Surface Sweep: Cast a sphere of radius r_h = 0.065\,m from the previous resolved hand position c_h,k-1 to the desired tracked world position t_h,k against climbable/ground layers (SurfaceMask). On hit at point p with normal n, clamp the physical hand to c_h,k = p + r_h n and set inContact = true.
  2. Play-Space Push-Off Impulse: While inContact is true, compute the hand's play-space delta Δh_rig = t_local,k - t_local,k-1, rotate it into world space via rig.TransformVector(...), and push the player rig in the opposite direction: $Δx_rig = -Δh_world$ Rotating from rig-local space guarantees snap turns never inject phantom rotational launch impulses!
  3. Sliding-Window Release Vault: Maintain a 5-frame ring buffer of rig-local hand velocities v_h,i and take a filtered peak-weighted launch vector on liftoff (or when the hand swings faster than the body): $v_launch = -clamp\!(α\,lerp(v_h, v_peak, 0.55),\; v_max)$ Typical tuning: boost factor $\alpha = 1.25$, max launch speed $v_{\max} = 8.5\,\text{m/s}$, gravity $g = 14.0\,\text{m/s}^2$, air drag $0.15\,\text{s}^{-1}$, and a minimum push threshold $v_{\min} = 0.65\,\text{m/s}$ so resting hands on a ledge does not jitter the player.
  4. Comfort Horizon: Never tilt, roll, or pitch GameXR.Rig. Only translate the rig and apply optional right-stick 30° snap turns (GameXR.Vignette = true during rapid launches).

Engine Implementation

Arm-Push VR Rig Controller (Assets/Game/Runtime/VR/ArmPushLocomotion.cs)

using CCGD;
using UnityEngine;

namespace Game.VR
{
    /// <summary>
    /// Physical arm-push VR locomotion built directly on CCGD.GameXR with full flat-screen parity.
    /// Players push off floors, walls, and branches with either hand to vault, bounce, and climb.
    /// </summary>
    [RequireComponent(typeof(CharacterController))]
    public sealed class ArmPushLocomotion : MonoBehaviour
    {
        [Header("Surface Detection")]
        public LayerMask SurfaceMask = ~0;
        public float HandRadius = 0.065f;
        public float MaxArmReach = 1.05f;

        [Header("Momentum & Vaulting")]
        public float PushBoost = 1.25f;
        public float MaxLaunchSpeed = 8.5f;
        public float MinPushSpeed = 0.65f;
        public float Gravity = 14f;
        public float GroundFriction = 9f;
        public float AirDrag = 0.18f;

        [Header("Flat-Screen Fallback")]
        public float FlatMoveSpeed = 5.5f;
        public float FlatJumpSpeed = 6.8f;

        CharacterController cc;
        Vector3 bodyVelocity;
        float snapCooldown;

        sealed class HandContact
        {
            public bool WasTouching;
            public Vector3 PrevLocalPos;
            public Vector3 ResolvedWorldPos;
            public readonly Vector3[] VelRing = new Vector3[5];
            public int RingIndex;
            public int RingCount;
        }

        readonly HandContact left = new HandContact();
        readonly HandContact right = new HandContact();

        public Vector3 Velocity => bodyVelocity;
        public bool EitherHandTouching => left.WasTouching || right.WasTouching;

        void Awake()
        {
            cc = GetComponent<CharacterController>();
#if CCGD_VR
            // Own the rig position directly instead of copying the flat camera transform.
            GameXR.FollowGameCamera = false;
            GameXR.Vignette = true;
            GameXR.Entered += SyncRigToBody;
#endif
        }

        void OnDestroy()
        {
#if CCGD_VR
            GameXR.Entered -= SyncRigToBody;
#endif
        }

        void SyncRigToBody()
        {
#if CCGD_VR
            if (GameXR.Rig != null)
            {
                GameXR.Rig.position = transform.position;
                GameXR.Rig.rotation = Quaternion.Euler(0f, transform.eulerAngles.y, 0f);
            }
            left.RingCount = 0;
            right.RingCount = 0;
            left.WasTouching = false;
            right.WasTouching = false;
#endif
        }

        void Update()
        {
            float dt = Mathf.Clamp(Time.deltaTime, 0.001f, 0.05f);
#if CCGD_VR
            if (GameXR.Active && GameXR.Rig != null)
            {
                StepVrArmPush(dt);
                return;
            }
#endif
            StepFlatFallback(dt);
        }

#if CCGD_VR
        void StepVrArmPush(float dt)
        {
            Transform rig = GameXR.Rig;
            Transform head = GameXR.Head;

            // Optional comfort snap-turn on right stick X without adding launch impulses.
            snapCooldown = Mathf.Max(0f, snapCooldown - dt);
            var rightHand = GameXR.Hand("right");
            if (rightHand != null && snapCooldown <= 0f && Mathf.Abs(rightHand.Stick.x) > 0.65f)
            {
                float yawDelta = Mathf.Sign(rightHand.Stick.x) * 30f;
                Vector3 pivot = head != null ? new Vector3(head.position.x, transform.position.y, head.position.z) : transform.position;
                rig.RotateAround(pivot, Vector3.up, yawDelta);
                transform.position = rig.position;
                transform.rotation = Quaternion.Euler(0f, rig.eulerAngles.y, 0f);
                snapCooldown = 0.28f;
            }

            Vector3 pushMove = Vector3.zero;
            Vector3 launchCandidate = Vector3.zero;
            int contacts = 0;

            EvaluateHand(GameXR.Hand("left"), left, rig, head, dt, ref pushMove, ref launchCandidate, ref contacts);
            EvaluateHand(GameXR.Hand("right"), right, rig, head, dt, ref pushMove, ref launchCandidate, ref contacts);

            if (contacts > 0)
            {
                // Average simultaneous two-hand push displacements so clamping stays stable.
                pushMove /= contacts;
                cc.Move(pushMove);
                // Keep strongest launch velocity ready as the hand vaults off.
                if (launchCandidate.sqrMagnitude > bodyVelocity.sqrMagnitude)
                    bodyVelocity = launchCandidate;
                else
                    bodyVelocity = Vector3.Lerp(bodyVelocity, launchCandidate, 1f - Mathf.Exp(-14f * dt));
            }
            else
            {
                bodyVelocity.y -= Gravity * dt;
                float drag = cc.isGrounded ? GroundFriction : AirDrag;
                Vector3 horiz = new Vector3(bodyVelocity.x, 0f, bodyVelocity.z);
                horiz = Vector3.MoveTowards(horiz, Vector3.zero, horiz.magnitude * drag * dt);
                bodyVelocity.x = horiz.x;
                bodyVelocity.z = horiz.z;
                cc.Move(bodyVelocity * dt);
                if (cc.isGrounded && bodyVelocity.y < -0.5f) bodyVelocity.y = -0.5f;
            }

            // Keep horizontal rig aligned with solved CharacterController capsule (horizon always flat).
            rig.position = transform.position;
        }

        void EvaluateHand(
            XrHand hand,
            HandContact state,
            Transform rig,
            Transform head,
            float dt,
            ref Vector3 pushMove,
            ref Vector3 launchCandidate,
            ref int contacts)
        {
            if (hand == null || hand.Grip == null) { state.WasTouching = false; return; }

            Vector3 desiredWorld = hand.Grip.position;
            if (head != null)
            {
                Vector3 offset = desiredWorld - head.position;
                if (offset.magnitude > MaxArmReach)
                    desiredWorld = head.position + offset.normalized * MaxArmReach;
            }

            Vector3 localPos = rig.InverseTransformPoint(desiredWorld);
            if (state.RingCount == 0)
            {
                state.PrevLocalPos = localPos;
                state.ResolvedWorldPos = desiredWorld;
            }

            Vector3 localDelta = localPos - state.PrevLocalPos;
            Vector3 localVel = localDelta / dt;
            state.PrevLocalPos = localPos;

            state.VelRing[state.RingIndex] = localVel;
            state.RingIndex = (state.RingIndex + 1) % state.VelRing.Length;
            if (state.RingCount < state.VelRing.Length) state.RingCount++;

            Vector3 sweep = desiredWorld - state.ResolvedWorldPos;
            float dist = sweep.magnitude;
            bool touching = false;
            RaycastHit hit;

            if (dist > 0.0005f && Physics.SphereCast(state.ResolvedWorldPos, HandRadius, sweep / dist, out hit, dist + 0.01f, SurfaceMask, QueryTriggerInteraction.Ignore))
            {
                touching = true;
                state.ResolvedWorldPos = hit.point + hit.normal * HandRadius;
            }
            else if (Physics.CheckSphere(desiredWorld, HandRadius, SurfaceMask, QueryTriggerInteraction.Ignore))
            {
                touching = true;
                state.ResolvedWorldPos = desiredWorld;
            }
            else
            {
                state.ResolvedWorldPos = desiredWorld;
            }

            if (touching)
            {
                contacts++;
                if (!state.WasTouching)
                {
                    // Tactile surface slap feedback on initial touch.
                    hand.Pulse(0.35f, 0.045f);
                }
                Vector3 worldDelta = rig.TransformVector(localDelta);
                pushMove -= worldDelta;

                Vector3 filteredLocalVel = FilteredHandVelocity(state);
                if (filteredLocalVel.magnitude >= MinPushSpeed)
                {
                    Vector3 candidate = -rig.TransformVector(filteredLocalVel) * PushBoost;
                    candidate = Vector3.ClampMagnitude(candidate, MaxLaunchSpeed);
                    if (candidate.sqrMagnitude > launchCandidate.sqrMagnitude)
                        launchCandidate = candidate;
                }
            }
            state.WasTouching = touching;
        }

        static Vector3 FilteredHandVelocity(HandContact state)
        {
            Vector3 sum = Vector3.zero;
            Vector3 peak = Vector3.zero;
            for (int i = 0; i < state.RingCount; i++)
            {
                Vector3 v = state.VelRing[i];
                sum += v;
                if (v.sqrMagnitude > peak.sqrMagnitude) peak = v;
            }
            Vector3 mean = state.RingCount > 0 ? sum / state.RingCount : Vector3.zero;
            return Vector3.Lerp(mean, peak, 0.55f);
        }
#endif

        void StepFlatFallback(float dt)
        {
            Vector2 move = GameInput.Move;
            Vector3 wish = (transform.right * move.x + transform.forward * move.y);
            if (wish.sqrMagnitude > 1f) wish.Normalize();
            bodyVelocity.x = Mathf.Lerp(bodyVelocity.x, wish.x * FlatMoveSpeed, 1f - Mathf.Exp(-12f * dt));
            bodyVelocity.z = Mathf.Lerp(bodyVelocity.z, wish.z * FlatMoveSpeed, 1f - Mathf.Exp(-12f * dt));
            if (cc.isGrounded)
            {
                bodyVelocity.y = GameInput.JumpPressed ? FlatJumpSpeed : -1f;
            }
            else
            {
                bodyVelocity.y -= Gravity * dt;
            }
            cc.Move(bodyVelocity * dt);
        }
    }
}

Performance & Platform Traps

  • Ignore Player & Avatar Colliders in SurfaceMask: Put the player capsule and remote peer avatars on dedicated layers excluded from SurfaceMask; otherwise your hand immediately hits your own torso collider and rockets skyward.
  • No com.unity.xr.* Packages: Build exclusively on CCGD.GameXR under #if CCGD_VR. Adding external XR packages breaks WebGL compilation.
  • Keep Standalone Headset Budgets Tight: Climbing arenas with lush canopies or malls must stay under 150k triangles and 150 draw calls in VR (use GPU instancing for branches, trunks, and lights; never stack bloom/DOF post-processing in VR).
  • Zero Forced Rotation: Never tilt the camera when bouncing off a slanted tree trunk or wall; rotate only around world Y via snap-turn.

Verification Checklist

  1. Compile cleanly with compile and verify zero SurfaceMask self-collisions in PlayMode.
  2. In a PlayMode test using GameXR.Sim, sweep left and right hand positions downward across a floor collider and assert transform.position vaults upward/forward within [0.5 m, 8.5 m/s].
  3. Verify flat-screen fallback moves with WASD and jumps with Space when GameXR.Active is false.
  4. Confirm VR telemetry stays within standalone draw-call and triangle budgets and resumes flat frames cleanly on VR exit.

Official references

  • Valve VR Physics Locomotion Principles
  • Meta Quest Spatial Comfort & Velocity Clamping Guidelines
  • Another Axiom Hand-Surface Impulse Locomotion Pattern

More Unity 6 games

Games made with GameCrew on the same engine. No game has been built with this guide yet: these show what Unity 6 games here look like.

Saltwood Alley — Step up to the sunlit timber lanes of an old seaside arcade, feel the weight of turned maple in your palm, and bend real wrist-spin shots into tight vintage scoring cups.
Plays in VR

Saltwood Alley

Step up to the sunlit timber lanes of an old seaside arcade, feel the weight of turned maple in your palm, and bend real wrist-spin shots into tight vintage scoring cups.

Thin Air Errands — Three hundred metres up, with a storm on the way, you carry your own plank between rooftops, lay it across the gap, and walk it with your arms out.
Plays in VR

Thin Air Errands

Three hundred metres up, with a storm on the way, you carry your own plank between rooftops, lay it across the gap, and walk it with your arms out.

More Unity 6 techniques

vr

Physical 6DoF VR Hand Interactions, Throw Windows & Spatial Comfort in Unity 6 →

Tactile 6DoF VR interactions in Unity 6 using CCGD.GameXR: articulated hands that wrap what they hold, near-grab + distance-pull cones, 6-sample sliding-window throws, snap holsters, diegetic world panels, and flat+VR parity.

ai

Horror Stalker AI, Acoustic Stealth, Flashlight Readability & Liminal Backrooms in Unity 6 →

Tension-driven horror stalker AI and readable darkness in Unity 6: patrol/investigate/stalk/chase/search state machine, acoustic noise radius, hiding-spot check logic, volumetric flashlight readability, spatial heartbeat audio, and non-softlocking key-hunt loops.

gameplay

Solo-First Multiplayer Rooms, Named Hubs & VR Avatars with CCGD.GameNet in Unity 6 →

Browser-ready multiplayer in Unity 6 using CCGD.GameNet: solo-first host authority, 60 Hz interpolated avatars, named social rooms (JoinRoom/LeaveRoom), VR head-and-hand pose sync, cosmetic tags, and deterministic GameNet.Sim PlayMode tests.

gameplay

Frame-Rate-Independent Procedural Springs, Squash-Stretch & Trauma Feel in Unity 6 →

Exact dt-invariant second-order critically/under-damped spring dampers, Squirrel Eiserloh T^2 rotational Perlin camera trauma, volume-preserving squash-and-stretch, and TestClock-safe hit-stop.

Read via free MCP — or sign in to add techniques & beta test

Use /mcp/library free with no login to query guides, or connect via OAuth at /mcp to contribute technique guides and beta test cloud builds.

Connect via MCP