distance lerp for non body height work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-06-05 17:28:04 -04:00
parent 483ff9b8d1
commit a2049e8ec5
2 changed files with 5 additions and 1 deletions

View File

@ -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)

View File

@ -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;