JumpReach class final
How far a body can jump, from the three numbers that decide it.
A value class rather than the whole MovementTuning, because this package
is asked by a field that keys its cache on it, and two bodies that jump
alike should share a field however else they differ.
Constructors
- JumpReach({required double jumpSpeed, required double gravity, required double runSpeed})
-
const
- JumpReach.of(MovementTuning tuning)
-
The reach of a body that moves by
tuning, at its walking pace.factory
Properties
- gravity → double
-
Metres per second squared, positive.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- jumpSpeed → double
-
Upward speed at take-off, metres per second.
final
- maxRise → double
-
The highest ledge this reach lands on:
v² / 2g.no setter - runSpeed → double
-
Horizontal speed carried through the air. Air control is not modelled:
the body leaves the ground at this speed and keeps it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
gapFor(
double rise) → double? -
The horizontal distance covered while landing
risemetres above the take-off (negative for below), or null when the apex is lower than that. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
takes(
{required double rise, required double gap}) → bool -
Whether a jump of
gapmetres landingrisemetres higher is within this reach. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override