- Description
- Nested Class Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- reset()
- capture(Vector3d[], int)
- capture(Vector3d[], RailPath.SegmentCommitType[], int)
- capture(RailPath)
- captureSuffixFromProjection(RailPath, RailPath.Projection)
- isEmpty()
- isFinished()
- getWaypointCount()
- getWaypoint(int)
- getCursor()
- getSegmentProgress()
- isOnCommittedSegment()
- getCommittedSegmentEndWaypointIndex()
- getActiveSegmentCommitType()
- getRemainingDistance()
- projectRemaining(Vector3dc, RailPath.Projection)
- project(Vector3dc, RailPath.Projection)
- remainingEquivalentTo(RailPath, Vector3dc, double)
- advance(Vector3dc, double, Vector3d)
- snapY(Vector3d)
Class RailPath
Authoritative for the entity's path while traversing: advance(Vector3dc, double, Vector3d) keeps the per-tick
translation collinear with the segment direction it commits to. It can chain consecutive
segments inside the same tick, but only when the next segment is collinear (same direction,
same orientation) with the first segment of the tick. That preserves the dot-against-normal
signature the grazing-collision filter in MotionControllerBase.applyRailStep(Ref, Role, Vector3dc, RailStepConfig, RailStepResult, ComponentAccessor) relies on
at climb / drop / edge corners. Any unused step distance is banked into
carryOverDistance (capped by CARRY_OVER_FACTOR) and consumed next call.
snapY(Vector3d) re-asserts the path's Y profile at the start of each tick so external physics
(gravity, character pushback) cannot drift the entity off a CLIMB lip between ticks.
Intended to be owned by a single body-motion component instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadvance(org.joml.Vector3dc currentPosition, double stepDistance, org.joml.Vector3d out) Walks the path forward bystepDistancestarting at the current cursor and writes the world-space offset for this tick intoout.voidvoidcapture(org.joml.Vector3d[] waypoints, int count) Replaces the path with the suppliedwaypoints(using the firstcountentries), dropping consecutive duplicates withinMIN_WAYPOINT_OFFSET_SQ.voidcapture(org.joml.Vector3d[] waypoints, RailPath.SegmentCommitType[] segmentCommitTypes, int count) Replaces the path with the suppliedwaypoints(using the firstcountentries), dropping consecutive duplicates withinMIN_WAYPOINT_OFFSET_SQ.voidcaptureSuffixFromProjection(RailPath source, RailPath.Projection projection) Replaces this path withsource's suffix starting atprojection.intintdoubledoubleorg.joml.Vector3dcgetWaypoint(int index) intbooleanisEmpty()booleanbooleanbooleanproject(org.joml.Vector3dc position, RailPath.Projection result) booleanprojectRemaining(org.joml.Vector3dc position, RailPath.Projection result) Projectspositiononto the untraversed part of this path.booleanremainingEquivalentTo(RailPath candidate, org.joml.Vector3dc currentPosition, double tolerance) Compares the current remaining suffix with a candidate path that starts atcurrentPosition.voidreset()voidsnapY(org.joml.Vector3d position) Re-asserts the path's Y profile onpositionfor the current cursor / segment progress.
-
Constructor Details
-
RailPath
public RailPath() -
RailPath
public RailPath(int initialCapacity)
-
-
Method Details
-
reset
public void reset() -
capture
public void capture(@Nonnull org.joml.Vector3d[] waypoints, int count) Replaces the path with the suppliedwaypoints(using the firstcountentries), dropping consecutive duplicates withinMIN_WAYPOINT_OFFSET_SQ. Intended for callers that pre-process probeMove output (e.g.RailPathSmoother) and feed the result here. -
capture
public void capture(@Nonnull org.joml.Vector3d[] waypoints, @Nullable RailPath.SegmentCommitType[] segmentCommitTypes, int count) Replaces the path with the suppliedwaypoints(using the firstcountentries), dropping consecutive duplicates withinMIN_WAYPOINT_OFFSET_SQ.segmentCommitTypesmaps segmenti -> i+1to a commitment type and may be null when all segments are non-committed. -
capture
-
captureSuffixFromProjection
public void captureSuffixFromProjection(@Nonnull RailPath source, @Nonnull RailPath.Projection projection) Replaces this path withsource's suffix starting atprojection. The first waypoint is the projected position, followed by the remaining source waypoints. -
isEmpty
public boolean isEmpty() -
isFinished
public boolean isFinished() -
getWaypointCount
public int getWaypointCount() -
getWaypoint
@Nonnull public org.joml.Vector3dc getWaypoint(int index) -
getCursor
public int getCursor() -
getSegmentProgress
public double getSegmentProgress() -
isOnCommittedSegment
public boolean isOnCommittedSegment() -
getCommittedSegmentEndWaypointIndex
public int getCommittedSegmentEndWaypointIndex() -
getActiveSegmentCommitType
-
getRemainingDistance
public double getRemainingDistance() -
projectRemaining
public boolean projectRemaining(@Nonnull org.joml.Vector3dc position, @Nonnull RailPath.Projection result) Projectspositiononto the untraversed part of this path. The result is useful when deciding whether a newly-computed rail can safely replace the current one. -
project
-
remainingEquivalentTo
public boolean remainingEquivalentTo(@Nonnull RailPath candidate, @Nonnull org.joml.Vector3dc currentPosition, double tolerance) Compares the current remaining suffix with a candidate path that starts atcurrentPosition. Changes behind the current cursor are ignored. -
advance
public void advance(@Nonnull org.joml.Vector3dc currentPosition, double stepDistance, @Nonnull org.joml.Vector3d out) Walks the path forward bystepDistancestarting at the current cursor and writes the world-space offset for this tick intoout.Behaviour:
- If the current segment does not finish inside this tick, advances partially along it
and updates
segmentProgress. - If the current segment finishes inside this tick, snaps exactly to its end-waypoint
(using
currentPositionas the anchor so any accumulated drift from gravity, character pushback, or stopT clamping is absorbed by the snap rather than carried forward). - After a snap, may chain into subsequent segments (fully or partially) only while
the next segment is collinear and same-orientation with the first segment of this tick
(see
COLLINEARITY_EPSILON). This preserves thedot(translation, collisionNormal)signature the grazing filter relies on. - Any remaining unspent budget is banked into
carryOverDistancefor the next call, capped atstepDistance * CARRY_OVER_FACTOR.
- If the current segment does not finish inside this tick, advances partially along it
and updates
-
snapY
public void snapY(@Nonnull org.joml.Vector3d position) Re-asserts the path's Y profile onpositionfor the current cursor / segment progress.Between ticks the world physics integrator can drag the entity off the path in Y (gravity off a CLIMB lip is the common case). Calling this at the start of a tick, before issuing the next rail step, keeps the body sweep aligned with the path that probeMove already vetted. No-op when the path is finished or the deviation is below
NPCPhysicsMath.EPSILON_LENGTH.
-