From d25e07f35a5b12e3586686352becdc4e88cf32f3 Mon Sep 17 00:00:00 2001 From: austin Date: Mon, 12 Aug 2024 20:52:41 -0400 Subject: [PATCH] server rotation fix --- docs/src/progress/currenttarget.md | 1 - docs/src/progress/renderertodo.md | 2 ++ .../state/movement/groundmove/ServerGroundMovementTree.java | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/src/progress/currenttarget.md b/docs/src/progress/currenttarget.md index a3d17f35..790c03e6 100644 --- a/docs/src/progress/currenttarget.md +++ b/docs/src/progress/currenttarget.md @@ -18,5 +18,4 @@ Hitboxes between server and client feel wayyyy off + bug fixes - Walk animation does not interrupt on stopping walking diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index 82c5e5c7..dcf96691 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -518,6 +518,8 @@ Jump sound effects Don't play walking audio when entity is jumping Server alert client on collision Sound effect on sword hit +Fix walk animation not stopping on state change in ground movement trees +Fix server entity not rotating when ai commands it to (08/09/2024) Math overhaul diff --git a/src/main/java/electrosphere/entity/state/movement/groundmove/ServerGroundMovementTree.java b/src/main/java/electrosphere/entity/state/movement/groundmove/ServerGroundMovementTree.java index b8ef3d1a..9a7ebc3e 100644 --- a/src/main/java/electrosphere/entity/state/movement/groundmove/ServerGroundMovementTree.java +++ b/src/main/java/electrosphere/entity/state/movement/groundmove/ServerGroundMovementTree.java @@ -213,7 +213,6 @@ public class ServerGroundMovementTree implements BehaviorTree { } Quaterniond movementQuaternion = new Quaterniond().rotationTo(MathUtils.getOriginVector(), new Vector3d(facingVector.x,0,facingVector.z)).normalize(); Quaterniond rotation = EntityUtils.getRotation(parent); - rotation.set(movementQuaternion); //TODO: optimize away and document (I know for the moment if this exception isn't here it will bite me in the ass later) if(facingVector.length() == 0){ throw new IllegalStateException("Facing vector length is 0. This will break ODE4J"); @@ -255,6 +254,7 @@ public class ServerGroundMovementTree implements BehaviorTree { //state machine switch(state){ case STARTUP: { + rotation.set(movementQuaternion); if(poseActor != null){ String animationToPlay = determineCorrectAnimation(MovementTreeState.STARTUP); if( @@ -308,6 +308,7 @@ public class ServerGroundMovementTree implements BehaviorTree { ); } break; case MOVE: { + rotation.set(movementQuaternion); //check if can restart animation //if yes, restart animation if(poseActor != null){ @@ -361,6 +362,7 @@ public class ServerGroundMovementTree implements BehaviorTree { ServerScriptUtils.fireSignalOnEntity(parent, "entityGroundMove", AccessTransforms.getVector(position)); } break; case SLOWDOWN: { + rotation.set(movementQuaternion); //run slowdown code if(poseActor != null){ String animationToPlay = determineCorrectAnimation(MovementTreeState.SLOWDOWN);