Skip to main content

6DOF Aerodynamics

Everything else in the physics stack treats the bullet as a point, a position and a velocity, pushed around by forces. Six-degrees-of-freedom (6DOF) gives the bullet an orientation too, and simulates how that attitude interacts with the airflow: lift when it flies at an angle, a restoring moment that noses it back toward velocity, damping that kills wobble, and gyroscopic precession from axial spin.

This is the model you reach for when a bullet's attitude matters, a sniper round that must nose into its velocity, a spinning shell that precesses, a guided munition, or anywhere the bullet's pointing direction is visible or physically significant. For ordinary pistol and rifle fire, grenades, and arrows, the simpler drag and Magnus stack is sufficient and much cheaper. Reserve 6DOF for bullets where the attitude physics actually changes gameplay or presentation.


The Force Model​

Each step, 6DOF resolves the bullet's angle of attack (alpha), the angle between where it's pointing and where it's going, and derives forces and moments from it:

Force / momentFormula (as implemented)Field(s)
LiftCLalpha*sin(alpha) * 1/2rhov^2 * ALiftCoefficientSlope, ReferenceArea, AirDensity
Pitching momentCmalpha*sin(alpha) * 1/2rhov^2 * A * LPitchingMomentSlope, ReferenceLength
AoA-dependent dragdrag x (1 + AoADragFactor*sin^2alpha)AoADragFactor
Pitch/yaw dampingopposes off-axis angular velocityPitchDampingCoeff
Roll dampingdecays axial spinRollDampingCoeff
Gyroscopic precessionfrom axial spin about the spin MOISpinMOI, seeded spin

Here rho is AirDensity, v is speed, A is ReferenceArea, and L is ReferenceLength. The coefficients scale linearly with sin(alpha), the small-angle linearisation of a full aeroballistic model, which is the right tradeoff for game projectiles where flight stays near-axial.


Minimum Viable 6DOF​

6DOF is off by default. Enabling it and getting a stable, lifting bullet requires a handful of fields to be non-zero, the aerodynamic forces all scale through ReferenceArea and BulletMass, so if either is zero, no force reaches the solver.

local Behavior = Vetra.BehaviorBuilder.new()
:Physics()
:MaxDistance(1200)
:BulletMass(0.011) -- REQUIRED for 6DOF, forces convert to accel via a = F/m
:Done()
:SixDOF()
:Enabled(true)
:LiftCoefficientSlope(2.0) -- lift is 0 by default -> set it or the bullet won't lift
:ReferenceArea(4.5e-5) -- scales ALL aero forces; 0 means nothing happens
:ReferenceLength(0.031) -- moment arm for the pitching moment
:MomentOfInertia(2e-5) -- resistance to pitch/yaw rotation
:PitchDampingCoeff(0.02) -- kills wobble; without it, torque accumulates forever
:Done()
:Build()
BulletMass is mandatory for 6DOF

Standard casting integrates velocity directly with drag coefficients already tuned to the right velocity change, mass is never needed. 6DOF instead produces raw force vectors that must become acceleration via a = F / m, so zero mass is a division by zero. :Build() returns nil if BulletMass is 0 while 6DOF is enabled.


Every 6DOF Field​

SetterFieldDefaultDescription
:Enabled(b)SixDOFEnabledfalseMaster switch.
:LiftCoefficientSlope(n)LiftCoefficientSlope0dCL/dalpha. 0 disables lift entirely.
:PitchingMomentSlope(n)PitchingMomentSlope0dCm/dalpha. Negative values give a stabilising restoring moment.
:PitchDampingCoeff(n)PitchDampingCoeff0Cmq. Damps pitch/yaw wobble. 0 means undamped.
:RollDampingCoeff(n)RollDampingCoeff0Clp. Decays axial spin over time.
:AoADragFactor(n)AoADragFactor0Extra drag at angle of attack: x(1 + factor*sin^2alpha).
:ReferenceArea(n)ReferenceArea0Cross-sectional area. Scales all aero forces, 0 = no forces.
:ReferenceLength(n)ReferenceLength0Moment arm for the pitching moment.
:AirDensity(n)AirDensity1.225kg/m^3. Sea level = 1.225. Lower = thinner air, weaker forces.
:MomentOfInertia(n)MomentOfInertia0Transverse (pitch/yaw) rotational inertia.
:SpinMOI(n)SpinMOI0Axial (roll) moment of inertia. Set >0 for gyroscopic precession.
:MaxAngularSpeed(n)MaxAngularSpeed200piAngular velocity clamp, rad/s, a stability safety cap.
:InitialOrientation(cf)InitialOrientationnilStarting attitude. nil = aligned with the fire direction.
:InitialAngularVelocity(v)InitialAngularVelocitynilSeed angular velocity (axial spin, initial tumble).
:CLAlphaMachTable(t)CLAlphaMachTablenilMach-indexed lift-slope lookup: { {mach, value}, ... }.
:CmAlphaMachTable(t)CmAlphaMachTablenilMach-indexed pitching-moment-slope lookup.
:CmqMachTable(t)CmqMachTablenilMach-indexed pitch-damping lookup.
:ClpMachTable(t)ClpMachTablenilMach-indexed roll-damping lookup.

Air Density​

AirDensity is in kg/m^3 and defaults to sea-level standard, 1.225. Lower it to weaken every aerodynamic force proportionally, useful for high-altitude engagements or thin-atmosphere maps.

AltitudeDensity
Sea level1.225
2 km1.007
4 km0.819
8 km0.526

Mach-Variable Coefficients​

By default the aero coefficients are constant slopes scaled by sin(alpha). When you need coefficients that vary with speed, the way real drag and stability change through transonic flight, supply a Mach-indexed lookup table for any of the four coefficients. Each is a list of { mach, value } pairs, interpolated at the bullet's current Mach number:

:SixDOF()
:Enabled(true)
:CLAlphaMachTable({ {0.0, 2.0}, {0.9, 2.4}, {1.2, 3.1}, {2.0, 2.7} })
:CmAlphaMachTable({ {0.0, -0.4}, {1.0, -0.6}, {2.0, -0.5} })
-- ...plus the required ReferenceArea, MomentOfInertia, etc.
:Done()

When a table is set, it overrides the corresponding constant slope. Leave them nil for the simpler linear model.


Troubleshooting​

The bullet doesn't curve or react to angle of attack. Check, in order: SixDOFEnabled = true; LiftCoefficientSlope > 0 (it's 0 by default, which disables lift); ReferenceArea > 0 (it scales all forces to zero when zero); and BulletMass > 0.

The bullet immediately tumbles or spins out. MomentOfInertia is probably too small, or PitchDampingCoeff is 0. Without damping every aerodynamic torque permanently accumulates angular velocity, compounding each step. Add PitchDampingCoeff first (0.02 is a safe start), then adjust MomentOfInertia until the wobble response feels right. A stiffer restoring torque via a negative PitchingMomentSlope also stabilises the round.

Can I use 6DOF without Magnus spin? Yes. InitialAngularVelocity can seed axial spin directly. With neither set, the bullet starts at zero angular velocity and only develops spin from aerodynamic torques, physically correct for an unspun round. Set SpinMOI > 0 only when you want gyroscopic precession.

Does it work in newParallel()? Yes. All 6DOF computation is pure math with no Instance access or cross-Actor callbacks; InitialOrientation and InitialAngularVelocity serialize by value. There's no parallel-specific penalty beyond the extra per-step math.


How It Compares​

No other publicly available Roblox projectile library implements six-degrees-of-freedom aerodynamics, the common alternatives model a point mass with no orientation, no aerodynamic torque, and no angular dynamics. The reference model for real 6DOF projectile simulation comes from small-arms research (McCoy's Modern Exterior Ballistics, the BRL 6DOF model); Vetra covers the same fundamental forces, with the linearisation described above as the main simplification. When you need speed-dependent coefficients, the four Mach tables let you supply your own curves. For genuine exterior-ballistics research, a dedicated tool is still the right choice, but for a Roblox game, this is a level of fidelity nothing else offers.