Skip to content

GravityCore quick start

This guide assumes GravityCore is installed.

  1. Drop a GravitySourceActor into your level, or add a Gravity Source component to any actor.

  2. 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.

  3. Give your character gravity movement. The quickest way is to base your Character Blueprint on the included BP_PlanetPerson, or reparent it to AGravityCharacter. To convert your own character, see below.

  4. 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.

  5. 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.

Where volumes overlap, the highest Priority wins, for both direction and strength.

  1. Leave the large outer volume (your planet) at Priority 0.

  2. Place a smaller volume of any shape inside it, for example a Box room, and set its Priority to 1.

  3. 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.

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”
  1. Add a Gravity Body component (UGravityBodyComponent) to any actor whose mesh should fall.

  2. 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.

All the gravity logic lives in UGravityMovementComponent. A character just has to use it and let it own rotation.

  1. 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))
  2. Let the component own rotation:

    bUseControllerRotationPitch = bUseControllerRotationYaw = bUseControllerRotationRoll = false;
    GetCharacterMovement()->bOrientRotationToMovement = false;
    GetCharacterMovement()->RotationRate = FRotator::ZeroRotator;
  3. Set bReplicates = true. The class must be an ACharacter, not a plain APawn.

  4. Make sure a gravity source is in range. Otherwise gravity falls back to the level default.