From a2049e8ec55f807b8deacdd951f1a3236526defc Mon Sep 17 00:00:00 2001 From: austin Date: Thu, 5 Jun 2025 17:28:04 -0400 Subject: [PATCH] distance lerp for non body height work --- docs/src/progress/renderertodo.md | 1 + .../ai/nodes/actions/move/CollidableElevationLerpNode.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 19d79805..205196f9 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -2124,6 +2124,7 @@ Debug rendering for facing vectors Fix progressive pathfinding iteration Non-body ground movement animation work Synchronization change for memory pressure +Lerp non-body height differential based on distance (holds closer to ground) diff --git a/src/main/java/electrosphere/server/ai/nodes/actions/move/CollidableElevationLerpNode.java b/src/main/java/electrosphere/server/ai/nodes/actions/move/CollidableElevationLerpNode.java index 27c2180e..1ddbe179 100644 --- a/src/main/java/electrosphere/server/ai/nodes/actions/move/CollidableElevationLerpNode.java +++ b/src/main/java/electrosphere/server/ai/nodes/actions/move/CollidableElevationLerpNode.java @@ -9,6 +9,7 @@ import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree; import electrosphere.server.ai.blackboard.Blackboard; import electrosphere.server.ai.nodes.AITreeNode; import electrosphere.server.macro.structure.VirtualStructure; +import electrosphere.util.math.BasicMathUtils; /** * Lerps the elevation of non-body collidables @@ -45,9 +46,11 @@ public class CollidableElevationLerpNode implements AITreeNode { } else { throw new Error("Unsupported target type " + targetRaw); } + Vector3d currentPos = EntityUtils.getPosition(entity); + double dist = currentPos.distance(targetPos); if(ServerGroundMovementTree.hasServerGroundMovementTree(entity)){ ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(entity); - tree.setCollidableElevationTarget(targetPos.y); + tree.setCollidableElevationTarget(BasicMathUtils.lerp(currentPos.y,targetPos.y,1.0 / Math.max(1.0,dist))); } } return AITreeNodeResult.SUCCESS;