Skip to main content

ArrowFlightSettings

A class in Root.Township, the global namespace.

ScriptableObject for how arrows wobble in flight: a deviance curve over time, scaled by speed, arrow weight and flight modifiers. Also draws a debug flight path.

Constructors​

MemberWhat it is
ArrowFlightSettings()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

9 private and internal fields
MemberWhat it is
private float debugGizmosSpeedArrow speed used for the debug path.
private float devianceMultiplierBase multiplier for deviance.
private AnimationCurve devianceOverTimeDeviance in degrees over normalized flight time.
private float flightDurationFlight time the curve is normalized against, at the reference speed.
private float flightSpeedReference speed. Faster arrows move through the curve faster.
private bool isRandomDeviationAmountWhen true, each step deviates by a random fraction of the curve value.
private int numberOfIterationsPhysics steps simulated for the debug path.
private bool simulateGravityWhether the debug path adds gravity.
private float simulationLengthRead-only display of how many seconds the debug path covers.

Methods​

4 private and internal methods
MemberWhat it is
internal void DrawGizmos(int randomSeed, Transform arrowTransform, Transform tipTransform)Editor: draws a simulated flight path from the arrow tip for the given seed.
private float GetDeviance(IEnumerable<ArrowFlightSettingsModifier> modifiers)devianceMultiplier times the deviance multiplier of every flight modifier.
internal Vector3 GetVelocity(Vector3 currentVelocity, float flightTime, float flightSpeed, float materialWeightModifier, IEnumerable<ArrowFlightSettingsModifier> modifiers = null)Returns the next velocity: the current direction turned toward a random rotation by the curve's deviance, at the given speed.
private void OnValidate()Updates simulationLength from the iteration count.

Used in​

Members of other types that take, return or hold a ArrowFlightSettings: