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
enemy ai
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
+ rearchitecture
@ -17,4 +19,6 @@
Hitboxes between server and client feel wayyyy off
+ 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
Block override concept for hitboxes
Block sfx
Fix server hitboxes freaking out at animation end
# TODO

View File

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

View File

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

View File

@ -55,10 +55,12 @@ public class MicroSimulation {
// tree.simulate(Main.deltaFrames);
ParticleUtils.makeParticleBillboardFaceCamera(particle);
}
//update attached entity positions
AttachUtils.serverUpdateAttachedEntityPositions(dataCell);
//simulate behavior trees
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
for(Entity collidable : dataCell.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
ServerCollidableTree.getServerCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());