GravityCore quick start
This guide assumes GravityCore is installed.
1. Your first gravity volume
Section titled “1. Your first gravity volume”-
Drop a
GravitySourceActorinto your level, or add a Gravity Source component to any actor. -
Pick a Shape (Sphere, Cylinder or Box) and set its size: Radius, Half Height or Box Extent. Optionally set Gravity Strength (cm/s²; 980 = Earth). The editor immediately draws the volume boundary and red gravity-direction arrows.
-
Give your character gravity movement. The quickest way is to base your Character Blueprint on the included
BP_PlanetPerson, or reparent it toAGravityCharacter. To convert your own character, see below. -
Add a walkable mesh with collision (a sphere, cylinder or box static mesh) aligned to the volume. The gravity source provides the field, not the floor.
-
Place the character inside the volume and press Play. It is pulled by gravity, stands on the surface and walks around it. Press the First-Person key to switch views.
| Shape | Gravity direction | Typical use |
|---|---|---|
| Sphere | Toward the centre | Planets, moons, asteroids |
| Cylinder | Radially outward from the local Z axis | Ring worlds and O’Neill cylinders (walk the inside) |
| Box | Straight down the local −Z | Rooms, corridors, flip-gravity zones |
The volume’s orientation comes from the component transform, so rotate the component to point a cylinder’s axis or a box’s “down” wherever you like.
2. Add an override zone
Section titled “2. Add an override zone”Where volumes overlap, the highest Priority wins, for both direction and strength.
-
Leave the large outer volume (your planet) at Priority 0.
-
Place a smaller volume of any shape inside it, for example a Box room, and set its Priority to 1.
-
Walk into the room: its gravity takes over. Step out and the planet’s gravity resumes.
Stack more layers (0 → 1 → 2) for nested overrides. Give overlapping volumes distinct priorities: equal priorities fall back to registration order.
3. Set the gravity outside every volume
Section titled “3. Set the gravity outside every volume”Place an AGravityDefaults actor in the level to control what characters feel outside all volumes:
- Default Gravity Direction and Default Gravity Strength, or
- Zero Gravity Outside Volumes for space. Characters float upright and can fly with the up/down thrust input.
With no AGravityDefaults actor, gravity outside volumes is world-down at standard strength.
4. Make physics props fall toward the planet
Section titled “4. Make physics props fall toward the planet”-
Add a Gravity Body component (
UGravityBodyComponent) to any actor whose mesh should fall. -
That’s it. If the mesh isn’t simulating, the component sets it to Movable and turns simulation on for you.
Or drop in the ready-made AGravityPhysicsProp. If the gravity source itself moves (a ship or a moving platform), turn on Keep Awake so resting props are not left behind.
Use GravityCore on your own character
Section titled “Use GravityCore on your own character”All the gravity logic lives in UGravityMovementComponent. A character just has to use it and let it own rotation.
-
Use the component. In a Blueprint, open Class Settings → Component Class Overrides and override the inherited CharacterMovementComponent with
UGravityMovementComponent. In C++:: Super(ObjectInitializer.SetDefaultSubobjectClass<UGravityMovementComponent>(ACharacter::CharacterMovementComponentName)) -
Let the component own rotation:
bUseControllerRotationPitch = bUseControllerRotationYaw = bUseControllerRotationRoll = false;GetCharacterMovement()->bOrientRotationToMovement = false;GetCharacterMovement()->RotationRate = FRotator::ZeroRotator; -
Set
bReplicates = true. The class must be anACharacter, not a plainAPawn. -
Make sure a gravity source is in range. Otherwise gravity falls back to the level default.
