feat: landing slide prediction (theoretical + real) #1

Open
wait4mi wants to merge 2 commits from feature/landing-slide into main
Owner

Resume

Ajoute la prediction de glissage a l'atterrissage au mod ElytraTrajectory.

Phase glide (modifiee)

  • Plus d'arret sec sur collision laterale : la velocite est projetee sur la surface (wall-slide), ce qui permet de glisser en diagonale le long d'un mur.
  • Budget de 4 redirections max pour eviter les boucles dans les coins.
  • Sur impact face = UP (sol) : bascule en phase slide.

Phase slide (nouvelle)

  • Formule vanilla : v *= friction * 0.91 par tick.
  • friction lue dynamiquement sur le bloc sous le joueur (Block.getFriction()).
  • Aucun input joueur suppose (modele conservateur).
  • Arret a |v| < 0.005 b/tick ou 80 ticks max.

Distances attendues : ~3 blocs sur stone, ~20+ sur blue_ice.

Slide reel post-atterrissage

  • LandingTracker detecte la transition isFallFlying() -> false.
  • Capture position() + getDeltaMovement() reels, recalcule le slide via predictSlideOnly().
  • Affichage pendant 60 ticks (3 s) en remplacement de la prediction theorique.

Rendu

  • Glide : cyan -> magenta (inchange)
  • Slide : jaune -> orange
  • Point d'arret : + rouge au sol

CI

  • Trigger etendu a feature/** pour valider le build sur branche avant merge.

Test plan

  • CI verte sur cette branche
  • In-game : atterrissage sur stone (slide court ~3 blocs)
  • In-game : atterrissage sur blue_ice (slide long ~20 blocs)
  • In-game : approche diagonale d'un mur (trajectoire suit le mur)
  • In-game : pique + redressement (comparer prediction theorique vs slide reel)
  • In-game : marqueur + rouge present au point d'arret final
## Resume Ajoute la prediction de **glissage a l'atterrissage** au mod ElytraTrajectory. ### Phase glide (modifiee) - Plus d'arret sec sur collision laterale : la velocite est projetee sur la surface (wall-slide), ce qui permet de glisser en diagonale le long d'un mur. - Budget de 4 redirections max pour eviter les boucles dans les coins. - Sur impact face = UP (sol) : bascule en phase slide. ### Phase slide (nouvelle) - Formule vanilla : `v *= friction * 0.91` par tick. - `friction` lue dynamiquement sur le bloc sous le joueur (`Block.getFriction()`). - Aucun input joueur suppose (modele conservateur). - Arret a `|v| < 0.005 b/tick` ou 80 ticks max. Distances attendues : ~3 blocs sur stone, ~20+ sur blue_ice. ### Slide reel post-atterrissage - `LandingTracker` detecte la transition `isFallFlying() -> false`. - Capture `position()` + `getDeltaMovement()` reels, recalcule le slide via `predictSlideOnly()`. - Affichage pendant 60 ticks (3 s) en remplacement de la prediction theorique. ### Rendu - Glide : cyan -> magenta (inchange) - Slide : jaune -> orange - Point d'arret : `+` rouge au sol ### CI - Trigger etendu a `feature/**` pour valider le build sur branche avant merge. ## Test plan - [ ] CI verte sur cette branche - [ ] In-game : atterrissage sur stone (slide court ~3 blocs) - [ ] In-game : atterrissage sur blue_ice (slide long ~20 blocs) - [ ] In-game : approche diagonale d'un mur (trajectoire suit le mur) - [ ] In-game : pique + redressement (comparer prediction theorique vs slide reel) - [ ] In-game : marqueur `+` rouge present au point d'arret final
feat: add landing slide prediction (theoretical + real)
All checks were successful
Build ElytraTrajectory / build (push) Successful in 38s
815e8d4b68
Refactors TrajectoryPredictor to keep simulating past the first
collision instead of stopping there:

- Glide phase now slides along walls/ceilings (projects velocity onto
  the surface) so a diagonal approach keeps moving instead of dead-
  stopping, with a redirect budget to avoid infinite loops in corners.
- When the simulation lands on top of a block (face = UP), a second
  "slide" phase is run with the residual horizontal velocity and the
  block-below friction (vanilla formula: v *= friction * 0.91 per
  tick, no player input assumed).

predict() now returns a Prediction(glidePath, slidePath, stopPoint,
landed) struct.

The renderer draws both phases plus a red "+" marker at the predicted
stop point: cyan->magenta for glide (unchanged), yellow->orange for
slide.

LandingTracker watches the fall-flying transition each client tick.
On touchdown it captures the player's real position+velocity and
recomputes the slide prediction (via predictSlideOnly), shown for ~3 s
in place of the theoretical one — lets the user see the actual landing
point with the real velocity rather than the pre-landing estimate.

Build CI also runs on feature/** branches so we can validate before
merging to main.
fix(slide): apply friction after move, not before (vanilla order)
All checks were successful
Build ElytraTrajectory / build (push) Successful in 36s
355f9f45ab
The slide phase was decaying velocity *before* the first move, which
made the predicted distance roughly half the vanilla value (on stone:
~2.4 blocks predicted vs ~4.4 actual). Vanilla LivingEntity#travel for
ground motion uses the current velocity to move, then sets the next
tick's velocity to v * friction * 0.91 — drag is applied after move,
not before. Match that ordering.

Also:
- Match vanilla's friction probe offset (0.500001 below feet, like
  getBlockPosBelowThatAffectsMyMovement) instead of 0.2.
- Raise MAX_SLIDE_TICKS to 200 and lower the stop threshold to
  0.003 b/tick so long slides on blue_ice / packed_ice aren't
  truncated by the safety cap.
All checks were successful
Build ElytraTrajectory / build (push) Successful in 36s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feature/landing-slide:feature/landing-slide
git switch feature/landing-slide

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feature/landing-slide
git switch feature/landing-slide
git rebase main
git switch main
git merge --ff-only feature/landing-slide
git switch feature/landing-slide
git rebase main
git switch main
git merge --no-ff feature/landing-slide
git switch main
git merge --squash feature/landing-slide
git switch main
git merge --ff-only feature/landing-slide
git switch main
git merge feature/landing-slide
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
wait4mi/elytra-trajectory!1
No description provided.