Skip to main content

Field Reference

Every VetraBehavior field, its default, and what it affects, grouped by the sub-builder that sets it. Use BehaviorBuilder setters (shown in the first column) for typed, validated configuration, or set the raw Field on a plain table passed to Solver:Fire(). Both produce the same behavior.

Reading the defaults

Defaults are what a field holds when you never touch it. nil or 0 usually means the feature is off until you set it. Fields that link to a deeper page have a full explanation there.


Physics, :Physics()​

Core motion and lifetime. See Gravity & Drag and the physics overview.

SetterFieldDefaultAffects
:MaxDistance(n)MaxDistance500Max path length in studs before the cast terminates (Distance).
:MaxDisplacement(n)MaxDisplacement0 (off)Max straight-line distance from the muzzle before terminating (Displacement).
:MinSpeed(n)MinSpeed1Speed floor, drop below it and the cast terminates (Speed).
:MaxSpeed(n)MaxSpeedinfSpeed ceiling.
:Gravity(v)Gravityworkspace.GravityGravity vector. Any Vector3 is used as given, including Vector3.zero for no drop. Unset falls back to workspace gravity.
:Acceleration(v)AccelerationVector3.zeroConstant extra acceleration added on top of gravity.
:RaycastParams(rp)RaycastParamsRaycastParams.new()Raycast filter used for hit detection. Applies within a raycast that runs, an occupancy grid decides whether it runs at all.
:CastFunction(fn)CastFunctionworkspace:RaycastCustom cast (Spherecast/Blockcast/etc.). Ignored by the parallel solver.
:BulletMass(n)BulletMass0Mass (kg). Unused by standard casting; required (> 0) for 6DOF.

Drag, :Drag()​

Air resistance. See Gravity & Drag.

SetterFieldDefaultAffects
:Coefficient(n)DragCoefficient0 (off)Master drag scale (decel = Coeff*Cd*v^2), not a ballistic coefficient.
:Model(enum)DragModelQuadraticDrag curve: Quadratic, Linear, G1,G8, GL, Custom.
:SegmentInterval(n)DragSegmentInterval0.05Seconds between drag/Magnus/gyro recalculations.
:CustomMachTable(t)CustomMachTablenil{ {mach, cd}, ... } lookup, required when DragModel = Custom.

Speed Profiles, :SpeedProfiles()​

Different physics above/below thresholds. See Speed Profiles.

SetterFieldDefaultAffects
:Thresholds(t)SpeedThresholds{}Speeds (studs/s) at which the profile switches and OnSpeedThresholdCrossed fires.
:Supersonic()SupersonicProfilenilProfile applied while above the highest crossed threshold.
:Subsonic()SubsonicProfilenilProfile applied while below it.

Each profile (:Supersonic() / :Subsonic()) overrides these fields for its regime, anything unset falls back to the base behavior:

SetterOverridesAffects
:DragCoefficient(n)DragCoefficientDrag scale for this regime.
:DragModel(enum)DragModelDrag curve for this regime.
:Restitution(n)RestitutionBounce energy retention in this regime.
:MaterialRestitution(t)MaterialRestitutionPer-material restitution overrides in this regime.
:NormalPerturbation(n)NormalPerturbationBounce scatter in this regime.

Magnus, :Magnus()​

Spin-induced curve. See Magnus & Spin.

SetterFieldDefaultAffects
:SpinVector(v)SpinVectorVector3.zeroSpin axis (direction) x rate (magnitude, rad/s).
:Coefficient(n)MagnusCoefficient0 (off)Magnus force scale. Very sensitive, start ~0.00005.
:SpinDecayRate(n)SpinDecayRate0Fraction of spin lost per second.

Gyroscopic Drift, :GyroDrift()​

Slow directional yaw. See Magnus & Spin.

SetterFieldDefaultAffects
:Rate(n)GyroDriftRatenil (off)Lateral drift rate in 1/s, acceleration per unit speed (accel = Rate * speed).
:Axis(v)GyroDriftAxisnil -> world UPDrift axis; nil models right-hand rifling.

Tumble, :Tumble()​

Loss of stability. See Tumble.

SetterFieldDefaultAffects
:SpeedThreshold(n)TumbleSpeedThresholdnil (off)Begin tumbling below this speed.
:DragMultiplier(n)TumbleDragMultiplier3.0Drag multiplier applied while tumbling.
:LateralStrength(n)TumbleLateralStrength0Chaotic lateral acceleration while tumbling, studs/s^2.
:OnPierce(b)TumbleOnPiercefalseBegin tumbling immediately on first pierce.
:RecoverySpeed(n)TumbleRecoverySpeednil (permanent)Re-stabilise if speed climbs back above this.

Homing, :Homing()​

Target steering. See Homing.

SetterFieldDefaultAffects
:PositionProvider(fn)HomingPositionProvidernilReturns the target position each step; nil return disengages.
:Strength(n)HomingStrength90Max steering rate, degrees/second.
:MaxDuration(n)HomingMaxDuration3Seconds before homing auto-disengages.
:AcquisitionRadius(n)HomingAcquisitionRadius0Delay engagement until within this many studs; 0 engages at once.
:Filter(fn)CanHomeFunctionnilPer-step predicate; return false to suspend steering this frame.

Pierce, :Pierce()​

Passing through surfaces. See Penetration.

SetterFieldDefaultAffects
:Filter(fn)CanPierceFunctionnilPer-hit predicate; without it, nothing pierces.
:Max(n)MaxPierceCount3Lifetime pierce budget.
:SpeedThreshold(n)PierceSpeedThreshold50Below this speed the bullet can't pierce (hit is terminal).
:SpeedRetention(n)PierceSpeedRetention0.8Fraction of speed kept per pierce.
:NormalBias(n)PierceNormalBias1.0How much the exit direction bends toward the surface normal.
:PierceDepth(n)PierceDepth0Extra forward offset on re-emergence to clear the back face.
:PierceForce(n)PierceForce0Speed cost scaled by surface thickness.
:ThicknessLimit(n)PierceThicknessLimit500Surfaces thicker than this (studs) stop the bullet.

Fragmentation, :Fragmentation()​

Shatter on pierce. See Fragmentation.

SetterFieldDefaultAffects
:OnPierce(b)FragmentOnPiercefalseSpawn child bullets when the bullet pierces.
:Count(n)FragmentCount3Number of fragments per event.
:Deviation(n)FragmentDeviation15Fragment cone half-angle, degrees.

Bounce, :Bounce()​

Ricochet off surfaces. See Bounce.

SetterFieldDefaultAffects
:Filter(fn)CanBounceFunctionnilPer-hit predicate; without it, nothing bounces.
:Max(n)MaxBounces5Lifetime bounce budget.
:SpeedThreshold(n)BounceSpeedThreshold20Below this speed, hits are terminal (filter is skipped).
:Restitution(n)Restitution0.7Fraction of speed retained per bounce.
:MaterialRestitution(t)MaterialRestitution{}Per-Enum.Material restitution overrides.
:NormalPerturbation(n)NormalPerturbation0.0Random scatter added to the reflected direction.
:ResetPierceOnBounce(b)ResetPierceOnBouncefalseClear the pierced-instance list after each bounce.

Corner Trap, :CornerTrap()​

Terminates bullets stuck bouncing in a corner. See Bounce > Corner Traps.

SetterFieldDefaultAffects
:TimeThreshold(n)CornerTimeThreshold0.002Time window used to detect a stuck oscillation.
:PositionHistorySize(n)CornerPositionHistorySize4How many recent positions the detector tracks.
:DisplacementThreshold(n)CornerDisplacementThreshold0.5Min net displacement expected; below it looks trapped.
:EMAAlpha(n)CornerEMAAlpha0.4Smoothing factor for the progress moving-average.
:EMAThreshold(n)CornerEMAThreshold0.25Smoothed-progress level below which the bullet is terminated.
:MinProgressPerBounce(n)CornerMinProgressPerBounce0.3Min fraction of progress each bounce must make.

High Fidelity, :HighFidelity()​

Sub-segment raycasting that hugs a curving trajectory so it can't chord past geometry the arc crosses. See High Fidelity for how to tune these, and Tunnelling & Precision for the problem they solve.

SetterFieldDefaultAffects
:SegmentSize(n)HighFidelitySegmentSize0.5Max chord length per sub-ray; smaller hugs the arc tighter. 0 disables HF.
:FrameBudget(n)HighFidelityFrameBudget4Max milliseconds/frame spent on sub-segments (adaptive).
:AdaptiveScale(n)AdaptiveScaleFactor1.5How aggressively segment size scales to stay near budget.
:MinSegmentSize(n)MinSegmentSize0.1Floor the adaptive controller won't shrink below.
:MaxBouncesPerFrame(n)MaxBouncesPerFrame10Cap on bounces resolved in a single frame (loop guard).

6DOF, :SixDOF()​

Full attitude aerodynamics. See 6DOF.

SetterFieldDefaultAffects
:Enabled(b)SixDOFEnabledfalseMaster switch for 6DOF.
:LiftCoefficientSlope(n)LiftCoefficientSlope0 (off)dCL/dalpha, lift per angle of attack.
:PitchingMomentSlope(n)PitchingMomentSlope0dCm/dalpha, restoring moment; negative = stabilising.
:PitchDampingCoeff(n)PitchDampingCoeff0Damps pitch/yaw wobble; 0 = undamped.
:RollDampingCoeff(n)RollDampingCoeff0Decays 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 = none).
:ReferenceLength(n)ReferenceLength0Moment arm for the pitching moment.
:AirDensity(n)AirDensity1.225Air density, kg/m^3 (sea level = 1.225).
:MomentOfInertia(n)MomentOfInertia0Transverse (pitch/yaw) rotational inertia.
:SpinMOI(n)SpinMOI0Axial (roll) inertia; > 0 enables gyroscopic precession.
:MaxAngularSpeed(n)MaxAngularSpeed200piAngular-velocity clamp (rad/s), stability cap.
:InitialOrientation(cf)InitialOrientationnilStarting attitude; nil = aligned with fire direction.
:InitialAngularVelocity(v)InitialAngularVelocitynilSeed angular velocity (spin / initial tumble).
:CLAlphaMachTable(t)CLAlphaMachTablenilMach-indexed lift-slope lookup.
:CmAlphaMachTable(t)CmAlphaMachTablenilMach-indexed pitching-moment-slope lookup.
:CmqMachTable(t)CmqMachTablenilMach-indexed pitch-damping lookup.
:ClpMachTable(t)ClpMachTablenilMach-indexed roll-damping lookup.

Custom Trajectory, :Trajectory()​

Scripted path replacing physics. See Custom Trajectories.

SetterFieldDefaultAffects
:Provider(fn)TrajectoryPositionProvidernil(elapsed) -> Vector3? position function; overrides the kinematic solver.

Wind, :Wind()​

Per-bullet wind sensitivity (wind vector is set on the solver). See Wind & Coriolis.

SetterFieldDefaultAffects
:Response(n)WindResponse1.0Fraction of the solver's wind applied to this bullet; 0 opts out.

LOD, :LOD()​

Distance-based step throttling. See Level of Detail.

SetterFieldDefaultAffects
:Distance(n)LODDistance0 (off)Studs from the LOD origin beyond which the bullet down-steps.
:Interval(n)LODInterval3Step 1 frame in n once beyond Distance. Must be >= 1; 1 disables throttling. Skipped time is banked and released on the catch-up step.

Occupancy, :StaticOccupancy() / :DynamicOccupancy()​

Voxel-grid raycast skipping. See Occupancy.

SetterFieldDefaultAffects
:StaticOccupancy(grid)StaticOccupancynilBaked grid of unmoving geometry; clear segments skip the raycast.
:DynamicOccupancy(set)DynamicOccupancynilSet of moving rigid parts tested the same way. Wins on the serial solver; measures slower than leaving it off on Vetra.newParallel().

Cosmetic, :Cosmetic()​

Visual bullet part handling.

SetterFieldDefaultAffects
:Template(inst)CosmeticBulletTemplatenilInstance cloned as the visual bullet.
:Container(inst)CosmeticBulletContainernilParent the cosmetic bullets are placed under.
:Provider(fn)CosmeticBulletProvidernil(ctx) -> Instance?, pull a bullet from your own pool instead of cloning.
:AutoDelete(b)AutoDeleteCosmeticBullettrueDestroy the cosmetic bullet automatically when the cast terminates.
:NonQueryable(b)CosmeticBulletNonQueryabletrueSet CanQuery = false and CanTouch = false on the cloned cosmetic bullet so it cannot be hit by its own raycasts or trigger touch events. Applies to :Template() clones only, not parts from :Provider().

Top-Level Behavior Flags​

Set directly on BehaviorBuilder (no sub-builder).

SetterFieldDefaultAffects
:Hitscan(b)IsHitscanfalseResolve the whole path synchronously in Fire(), no per-frame physics. See Hitscan.
:BatchTravel(b)BatchTravelfalseAccumulate travel events and emit them once per frame via OnTravelBatch.
:FireTravelEvents(b)FireTravelEventstrueGate OnTravel/OnTravelBatch emission, on both solvers. Set false to suppress them, a significant optimization lever at volume. Does not change whether a parallel cast is sync or fire-and-forget. See Parallel.
:UserData(v)UserDatanilFree-form data carried with the bullet, available in every signal handler.
:Debug():Visualize(b)VisualizeCastsfalseDraw cast segments, hit normals, bounce vectors, and corner-trap markers in-world.

Composition Helpers​

Not behavior fields, builder methods for assembling behaviors. See the FAQ > Behaviors.

MethodDoes
:Clone()Independent copy of the builder (originals untouched).
:Impose(other)Copy only the explicitly-set fields of other onto this builder.
:Merge(a, b, ...)Non-destructive: clone, then impose each modifier in order.
:When(cond, fn)Run fn(self) only if cond is truthy; otherwise pass through unchanged.
BehaviorBuilder.Inherit(frozen)Static, turn a frozen behavior into a mutable, fully-dirty builder.
:Build()Validate and produce the final frozen VetraBehavior.