Coordinate systems
Axes, units, rotations and input signs used everywhere.
7 min read
Which way is up, which way a car faces, and what a positive input means. Every scenario and trace
uses RocketSim's conventions; the real-game runner converts in crates/realgame/src/frames.rs.
Each convention says where it was verified, and the last section says what the real game
confirmed.
World frame#
| Property | Value |
|---|---|
| Length unit | Unreal unit (uu); 50 uu = 1 m |
| Up | +Z. Gravity is (0, 0, -650) uu/s² |
| Teams | Blue defends -Y, Orange defends +Y |
| Soccar extents | side walls x = ±4096, back walls y = ±5120, ceiling plane z = 2048 in RocketSim (get_aabb; the real game's figure is ≈ 2044), floor z = 0 |
| Goals | back walls (y = ±5120), crossbar at z = 642.775, half-width 892.755 |
| Rest heights | ball centre z = 93.15 (radius 91.25); Octane origin z = 17 |
| Time | 120 physics ticks per second. Tick 0 is the state after setup (and warmup), before any recorded step |
Field names carry units: _uu, _uu_s, _rad, _rad_s, _ticks. Angular
velocity is in rad/s, about world axes.
Car local axes#
At identity rotation a car faces +X (forward), its right side points to +Y, and its roof points to +Z.
RocketSim stores orientation as rot_mat, whose columns are the car's
forward, right and up directions in world coordinates. That matrix has
determinant +1. With right = +Y at identity, the convention looks
left-handed: Unreal's forward/right/up is left-handed. Numerically, though, it is
an ordinary right-handed rotation matrix. The practical consequences:
A car facing +Y (yaw = +π/2) has its right side toward -X, not +X. Our scenario descriptions spell this out where it matters (the car–ball scenarios
cb01-*andcb03-*in the scenario catalog).Positive yaw turns the nose from +X toward +Y, which is counter-clockwise seen from above. This is a positive rotation about +Z in the usual right-handed sense, and it is a turn toward the car's right.
Positive pitch (nose up) is a rotation about the car's -right axis. Positive roll (right side down) is a rotation about the car's -forward axis. Measured on rocketsim 0.2.11 (scenarios
car-air-pitch/car-air-roll): full pitch input gives angular velocity ≈ (0, -5.6, 0) rad/s, and full roll gives ≈ (-5.6, 0, 0) rad/s at identity orientation.
rotation_pyr_rad (scenario files)#
CarInit.rotation_pyr_rad is [pitch, yaw, roll] in radians in the RLBot
convention:
pitch + = nose up
yaw + = nose from +X toward +Y
roll + = right side down
The conversion is implemented once, in sim_runner::orientation:
rot_mat = Mat3A::from_euler(EulerRot::ZYX, yaw, -pitch, -roll)So yaw is applied about world Z first, then pitch, then roll. This was verified
numerically against RocketSim with an exact round trip (pyr_from_rot_mat), and
by unit tests (yaw_turns_forward_from_x_toward_y,
positive_pitch_raises_the_nose, positive_roll_lowers_the_right_side). Use
the functions in sim_runner::orientation; never re-derive the convention
elsewhere.
The experimental GPU simulator builds the same
Mat3A::from_euler(ZYX, yaw, -pitch, -roll) on the device, with CPU-libm
sin/cos, so its tick-0 quaternion equals physlab's, sign of zero included
(GPU design).
Quaternions in traces#
CarSample.rotation_quat_wxyz is a unit quaternion [w, x, y, z]. It rotates
car-local vectors (x forward, y right, z up) into world coordinates, and it is
the same rotation as rot_mat. It is computed with
glam::Quat::from_mat3a(rot_mat).normalize().
q and -q describe the same orientation. Comparisons use the angle of the
relative rotation, 2·atan2(|v|, |w|) of conj(a)·b (in crates/compare),
which is exactly 0 for identical inputs. The requested state in trace metadata
stores the quaternion of rot_mat_from_pyr(rotation_pyr_rad).
The ball's orientation is not recorded.
Controller inputs#
Fields of ControlStep and trace::Controls. Signs as measured in RocketSim
0.2.11:
| Input | Range | Meaning |
|---|---|---|
throttle | -1..1 | + forward, - reverse/brake. On the ground with boost held and all four wheels in contact, RocketSim uses throttle 1 regardless |
steer | -1..1 | + steers right. At identity, + turns toward +Y. car-steer-medium and car-steer-medium-left end mirror-symmetric in y |
pitch | -1..1 | + nose up (air). Also the dodge direction: pitch -1 = forward flip, +1 = back flip |
yaw | -1..1 | + nose toward the car's right (air). Dodge: + = side flip to the right |
roll | -1..1 | + right side down (air) |
jump | bool | Edge-triggered: a press is jump && !previous_jump. A ground jump keeps adding force while held, for at least 3 ticks (MIN_TICKS, even for a 1-tick tap) and at most 24 (MAX_TICKS). A second press in the air within 1.25 s is a double jump, or a dodge if |pitch|+|yaw|+|roll| ≥ 0.5 |
boost | bool | Level-triggered. Uses 33.3 boost/s |
handbrake | bool | Level-triggered (powerslide) |
RocketSim clamps the analog inputs to -1..1 and quantizes them to the game's 8-bit inputs: negative values in steps of 1/128, positive in steps of 1/127. The game stores input on the same grid (0.5 reads back as 64/127 = 0.5039). Traces record the requested values, before that quantization.
The tap/hold limits were measured on the jump scenarios:
car-jump-tap-1andcar-jump-hold-3produce state-identical traces.So do
car-jump-hold-24andcar-jump-hold-40.
Control timing (which tick an input affects) is defined in Scenario catalog → Control timing.
Team mirroring#
Nothing is mirrored automatically. An Orange car is placed exactly where its
CarInit says, in the same world frame as Blue. Team only affects gameplay
rules, for example demolitions between opposing teams. RocketSim's
PhysState::flip_y (a 180° rotation about Z) is the usual way to mirror a state
between teams. The scenario runner does not use it.
The RL environment is the one place that mirrors: Orange's observations are
rotated 180° about Z (crates/rlenv/src/obs.rs, the RLGym DefaultObs
convention). Scenarios and the runners never mirror.
Setup detail: wheel contacts after a teleport#
Inside a step, RocketSim processes jump, flip and air-control input before it
re-casts the suspension rays. So the first step after set_car_state sees
whatever is_on_ground the state carried. CarState::DEFAULT carries true,
which would let a car placed in mid-air do a ground jump on its first step
(observed). sim_runner::setup::apply_initial_state therefore seeds
is_on_ground and wheels_with_contact from the initial pose. It does this by
stepping a throw-away clone of the arena once
(setup::probe_initial_wheel_contacts). The raycast depends only on poses, so
the clone computes exactly the contacts the first real step will see.
The runner also seeds the sticky-force gate. RocketSim pushes a car toward
the ground (half of gravity) only if the previous tick's wheel rays touched
the world, and a teleport cleared that. So a car placed at rest on the floor
got no sticky force on its first step, rose 2.7 uu/s faster than in the game,
and every jump ended 2.5–5 uu off. setup::seed_sticky_gates seeds the gate
from the new pose, and jumps then match the game at the measurement floor.
This is a fix in our runner, not a RocketSim patch; the training environment
resets the same way.
In the real game#
Checked in Free Play against RocketSim, on about 45 car scenarios: air control from several poses, front, back and side flips, tumbling falls from skewed poses, and cars facing +X and +Y.
Car orientation: verified. The game's rigid-body quaternion equals RocketSim's for the same
rotation_pyr_rad, so the game→schema conversion incrates/realgame/src/frames.rsis the identity for cars as it is for the ball. Orientation errors stay below 4e-4 rad.Input signs: verified for throttle, steer, pitch, yaw, roll, jump, boost, handbrake and the dodge direction. The game dodges along its own direction fields, which the plugin fills from the stick (forward = -pitch, strafe = yaw), and flips match.
Input scaling. The game scales input by the player's controller settings. The plugin sets RocketSim's values during a run (BakkesMod plugin).
Rotator mapping: not needed. The plugin sets the car's quaternion directly, so the Unreal
Rotator(integer units, 65536 per turn) never sits in between. The plugin still records the rotator for cross-checks.Hidden state after a teleport. The game keeps the old wheel contacts for one step; the plugin's settling frame handles that. For flips the game exposes "a flip is available" (
HasFlip), not RocketSim'shas_flipped, so that field is unknown in real traces.