distance lerp for non body height work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
483ff9b8d1
commit
a2049e8ec5
@ -2124,6 +2124,7 @@ Debug rendering for facing vectors
|
|||||||
Fix progressive pathfinding iteration
|
Fix progressive pathfinding iteration
|
||||||
Non-body ground movement animation work
|
Non-body ground movement animation work
|
||||||
Synchronization change for memory pressure
|
Synchronization change for memory pressure
|
||||||
|
Lerp non-body height differential based on distance (holds closer to ground)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import electrosphere.entity.state.movement.groundmove.ServerGroundMovementTree;
|
|||||||
import electrosphere.server.ai.blackboard.Blackboard;
|
import electrosphere.server.ai.blackboard.Blackboard;
|
||||||
import electrosphere.server.ai.nodes.AITreeNode;
|
import electrosphere.server.ai.nodes.AITreeNode;
|
||||||
import electrosphere.server.macro.structure.VirtualStructure;
|
import electrosphere.server.macro.structure.VirtualStructure;
|
||||||
|
import electrosphere.util.math.BasicMathUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lerps the elevation of non-body collidables
|
* Lerps the elevation of non-body collidables
|
||||||
@ -45,9 +46,11 @@ public class CollidableElevationLerpNode implements AITreeNode {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error("Unsupported target type " + targetRaw);
|
throw new Error("Unsupported target type " + targetRaw);
|
||||||
}
|
}
|
||||||
|
Vector3d currentPos = EntityUtils.getPosition(entity);
|
||||||
|
double dist = currentPos.distance(targetPos);
|
||||||
if(ServerGroundMovementTree.hasServerGroundMovementTree(entity)){
|
if(ServerGroundMovementTree.hasServerGroundMovementTree(entity)){
|
||||||
ServerGroundMovementTree tree = ServerGroundMovementTree.getServerGroundMovementTree(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;
|
return AITreeNodeResult.SUCCESS;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user