Super Mario Galaxy’s defining mechanic — walking on the outside of spherical planets, inside bowls, and along wires — is driven by a gravity subsystem that can blend contributions from any number of overlappingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/SMGCommunity/Petari/llms.txt
Use this file to discover all available pages before exploring further.
PlanetGravity instances at once. Every frame, PlanetGravityManager::calcTotalGravityVector iterates all registered sources, discards ones that do not cover the querying position, and accumulates a final gravity vector returned to the actor. Because each source carries a priority value, the manager can also report which source dominated, letting actors adjust their orientation, shadow projection, and magnet behaviour accordingly.
Base class
PlanetGravity is never instantiated directly. All concrete gravity types inherit from it and implement calcOwnGravityVector.
Gravity types
PlanetGravity (base) — virtual gravity field
PlanetGravity (base) — virtual gravity field
The abstract base class for all gravity sources. Stores shared fields such as
mRange, mPriority, mGravityType, and mIsInverse. Subclasses override calcOwnGravityVector to describe the field geometry.ParallelGravity — directional / planar gravity
ParallelGravity — directional / planar gravity
Produces a uniform directional field aligned to a configurable plane normal. Covers three range shapes: sphere, box, or cylinder. This is what large flat platforms and level-gravity areas use.
PointGravity — single-point attraction
PointGravity — single-point attraction
Pulls actors toward a single world-space point. Used for small celestial bodies and any scenario where gravity should converge on one location.
SegmentGravity — cylindrical / capsule gravity
SegmentGravity — cylindrical / capsule gravity
Defines a segment between two points. Actors are pulled toward the nearest point on the segment axis, producing a cylindrical gravity field with optional hemispherical caps at each end.
DiskGravity — flat disc field
DiskGravity — flat disc field
Attracts actors toward the surface of a circular disc. The disc has a configurable radius, a normal direction, and an optional edge-gravity band for actors beyond the rim.
DiskTorusGravity — torus / ring gravity
DiskTorusGravity — torus / ring gravity
Like
DiskGravity, but hollowed out into a torus. Actors are attracted toward the nearest point on the ring centerline rather than toward a flat surface centre.ConeGravity — cone-shaped field
ConeGravity — cone-shaped field
Pulls actors toward the nearest point on the surface of a cone. The x column of the stored matrix encodes the radius vector, and the y column encodes the axis from base to apex.
WireGravity — polyline / cable gravity
WireGravity — polyline / cable gravity
Attracts actors toward the nearest point along an arbitrary polyline defined by a list of vertices. Used for wire, rope, and cable objects.
PlanetGravityManager
PlanetGravityManager is the singleton that owns all active gravity sources for a stage. It is a NameObj and therefore participates in the normal init/movement lifecycle.
mGravities is a fixed-size array capped at 128 sources. Registering more than 128 gravity objects in one stage is unsupported.GravityInfo
GravityInfo is the result struct filled in by calcTotalGravityVector. Actors store one of these and read it every frame.
Gravity type flags
| Constant | Value | Purpose |
|---|---|---|
GRAVITY_TYPE_NORMAL | 1 | Standard actor gravity |
GRAVITY_TYPE_SHADOW | 2 | Shadow projection direction |
GRAVITY_TYPE_MAGNET | 4 | Magnet-suit attraction |
GRAVITY_TYPE_MARIO_LAUNCHER | 8 | Launch trajectory gravity |
Gravity power levels
| Constant | Value | Effect |
|---|---|---|
GRAVITY_POWER_LIGHT | 0 | Reduced pull strength |
GRAVITY_POWER_NORMAL | 1 | Standard pull strength |
GRAVITY_POWER_HEAVY | 2 | Increased pull strength |