fix server animation reset bug
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-08-12 15:26:38 -04:00
parent 8e6c9e97b0
commit b48501652c
5 changed files with 18 additions and 26 deletions

View File

@ -7,7 +7,9 @@
+ when popup is accepted, spawn an enemy with an effect + when popup is accepted, spawn an enemy with an effect
enemy ai enemy ai
review combat code (lifestate, damage calculation, etc) review combat code (lifestate, damage calculation, etc)
- Allow block hotboxxes to block damage - Damage event accumulator each frame on server side
Use accumulator to negate all damage if block box was hit
I-frames
audio fx for everything audio fx for everything
+ rearchitecture + rearchitecture
@ -17,4 +19,6 @@
Hitboxes between server and client feel wayyyy off Hitboxes between server and client feel wayyyy off
+ bug fixes + bug fixes
Capsule hitboxes aren't connecting correctly

View File

@ -541,6 +541,7 @@ Pass at client-server physics synchronization
Fix server animation playing at reduced timescale Fix server animation playing at reduced timescale
Block override concept for hitboxes Block override concept for hitboxes
Block sfx Block sfx
Fix server hitboxes freaking out at animation end
# TODO # TODO

View File

@ -67,8 +67,6 @@ public class AttachUtils {
String targetBone; String targetBone;
if((targetBone = getTargetBone(currentEntity))!=null){ if((targetBone = getTargetBone(currentEntity))!=null){
PoseActor parentActor = EntityUtils.getPoseActor(parent); PoseActor parentActor = EntityUtils.getPoseActor(parent);
//set rotation
Vector3d facingAngle = CreatureUtils.getFacingVector(parent);
//manual offset //manual offset
Vector3d offset = AttachUtils.getVectorOffset(currentEntity); Vector3d offset = AttachUtils.getVectorOffset(currentEntity);
@ -84,8 +82,7 @@ public class AttachUtils {
new Quaterniond(parentActor.getBoneRotation(targetBone)), new Quaterniond(parentActor.getBoneRotation(targetBone)),
new Vector3d(EntityUtils.getPosition(parent)), new Vector3d(EntityUtils.getPosition(parent)),
new Quaterniond(EntityUtils.getRotation(parent)), new Quaterniond(EntityUtils.getRotation(parent)),
new Vector3d(EntityUtils.getScale(parent)), new Vector3d(EntityUtils.getScale(parent))
new Vector3d(facingAngle)
); );
} }
} else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){ } else if(currentEntity.getData(EntityDataStrings.ATTACH_TARGET_BASE)!=null){
@ -205,13 +202,6 @@ public class AttachUtils {
if((targetBone = getTargetBone(child))!=null){ if((targetBone = getTargetBone(child))!=null){
Actor parentActor = EntityUtils.getActor(parent); Actor parentActor = EntityUtils.getActor(parent);
Vector3d facingAngle;
if(parent == Globals.firstPersonEntity){
facingAngle = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera)).mul(1,0,1).normalize();
} else {
facingAngle = CreatureUtils.getFacingVector(parent);
}
//manual offset //manual offset
Vector3d offset = AttachUtils.getVectorOffset(child); Vector3d offset = AttachUtils.getVectorOffset(child);
if(offset == null){ if(offset == null){
@ -226,8 +216,7 @@ public class AttachUtils {
new Quaterniond(parentActor.getBoneRotation(targetBone)), new Quaterniond(parentActor.getBoneRotation(targetBone)),
new Vector3d(EntityUtils.getPosition(parent)), new Vector3d(EntityUtils.getPosition(parent)),
new Quaterniond(EntityUtils.getRotation(parent)), new Quaterniond(EntityUtils.getRotation(parent)),
new Vector3d(EntityUtils.getScale(parent)), new Vector3d(EntityUtils.getScale(parent))
new Vector3d(facingAngle)
); );
} }
} }
@ -306,10 +295,7 @@ public class AttachUtils {
//parent transforms //parent transforms
Vector3d parentPosition, Vector3d parentPosition,
Quaterniond parentRotation, Quaterniond parentRotation,
Vector3d parentScale, Vector3d parentScale
//the parent's facing vector
Vector3d facingVector
){ ){
//transform bone space //transform bone space
Vector3d position = new Vector3d(offsetVector); Vector3d position = new Vector3d(offsetVector);
@ -321,11 +307,6 @@ public class AttachUtils {
position.add(parentPosition); position.add(parentPosition);
//set //set
EntityUtils.getPosition(child).set(position); EntityUtils.getPosition(child).set(position);
//set rotation
Vector3d facingAngle = facingVector;
if(facingAngle == null){
facingAngle = MathUtils.getOriginVector();
}
//calculate rotation of model //calculate rotation of model
EntityUtils.getRotation(child) EntityUtils.getRotation(child)
.identity() .identity()

View File

@ -33,6 +33,7 @@ public class PoseModel {
List<Bone> bones; List<Bone> bones;
Map<String,Bone> boneMap; Map<String,Bone> boneMap;
Matrix4d globalInverseTransform; Matrix4d globalInverseTransform;
Matrix4d rootTransform;
Map<String,AnimNode> nodeMap; Map<String,AnimNode> nodeMap;
AnimNode rootAnimNode; AnimNode rootAnimNode;
List<Animation> animations; List<Animation> animations;
@ -80,9 +81,12 @@ public class PoseModel {
//parse animation nodes and form hierarchy //parse animation nodes and form hierarchy
// //
AINode rootNode = scene.mRootNode(); AINode rootNode = scene.mRootNode();
globalInverseTransform = electrosphere.util.Utilities.convertAIMatrixd(rootNode.mTransformation()); rootTransform = electrosphere.util.Utilities.convertAIMatrixd(rootNode.mTransformation());
if(globalTransform != null){ if(globalTransform != null){
globalInverseTransform = new Matrix4d(rootTransform).invert().scale(globalTransform.getScale());
globalInverseTransform.scale(globalTransform.getScale()); globalInverseTransform.scale(globalTransform.getScale());
} else {
globalInverseTransform = new Matrix4d();
} }
rootAnimNode = buildAnimNodeMap(scene.mRootNode(),null); rootAnimNode = buildAnimNodeMap(scene.mRootNode(),null);

View File

@ -55,10 +55,12 @@ public class MicroSimulation {
// tree.simulate(Main.deltaFrames); // tree.simulate(Main.deltaFrames);
ParticleUtils.makeParticleBillboardFaceCamera(particle); ParticleUtils.makeParticleBillboardFaceCamera(particle);
} }
//update attached entity positions
AttachUtils.serverUpdateAttachedEntityPositions(dataCell);
//simulate behavior trees //simulate behavior trees
dataCell.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime()); dataCell.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime());
//update attached entity positions
//!!This must come after simulating behavior trees!!
//if it does not come after queueing animations, the attach positions might not represent the animation of the parent
AttachUtils.serverUpdateAttachedEntityPositions(dataCell);
//sum collidable impulses //sum collidable impulses
for(Entity collidable : dataCell.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){ for(Entity collidable : dataCell.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
ServerCollidableTree.getServerCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime()); ServerCollidableTree.getServerCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());