Description
This is "Boby's Planet Movement" — a custom gravity / planetary walking system for Unity + VRChat (UdonSharp).
It lets players (and rigidbodies) walk on spheres, cylinders, tubes, arbitrary colliders, etc., with the correct local “down” direction, instead of always falling toward world -Y.
Core Concept
Instead of Unity’s default Physics.gravity, every frame the system calculates a custom “up” vector based on all nearby gravity fields, then applies force in the opposite direction.
Main Scripts
PlanetMove_Gravbody.cs (attached to the player / moving object)
Requires a Rigidbody (with useGravity = false).
Every Update it:
Collects active PlanetMove_GravityField components that overlap its trigger.
Picks the highest-priority field(s).
Computes the net upDir.
Applies rb.AddForce(...) to simulate gravity toward that upDir.
Has a pool of gravity fields (default 32) for performance.
PlanetMove_GravityField (on every gravity zone)
Defines the shape and strength of gravity.
Four main types:
TypeWhat it doesTypical UseSphereGravity toward/away from a pointPlanets, spheresAxisGravity toward an infinite or capped lineTubes, cylinders, corridorsDirectionConstant direction (like normal gravity)Flat areas, directional pullColliderGravity toward the surface of any collider(s)Irregular terrainExtra options:
onlyInTrig → only affects you when inside the trigger collider.
priority → higher priority fields override lower ones.
strength (positive = pull toward center, negative = push away).
localOffset / worldOffset.
PlanetMove_GravityFieldGroup
Lets you combine multiple fields with different combine modes (not fully shown in the dump, but it’s there for advanced setups).
How You Use It (in the sample scene)
Enter the system → Interact with the big “Enter” button. This attaches the gravbody logic to the player.
Gravity Fields are placed around the map (you can see several in the hierarchy: Sphere, Axis Tube, Axis Capsule, Collider, etc.).
UI Toggles let you turn on/off:
Normal gravity fallback
Ground snapping
Comfort turning