Added puppet offsets and adjusted puppet leg pivots based on body angles.

This commit is contained in:
Luis C.M committed 2022-12-22 15:24:39 -06:00
1 parent 4f553a9ee4
commit bb7b33bf95
4 files changed
+106 -21

No files matched your search

@@ -570,10 +570,41 @@ public class ModelMPM extends ModelNPCMale{
this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightLeg.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 2.0F;
this.bipedRightLeg.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 2.0F;
this.bipedLeftLeg.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 2.0F;
this.bipedLeftLeg.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 2.0F;
this.bipedRightLeg.rotationPointX =
-MathHelper.cos(this.bipedBody.rotateAngleY) * 2.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleY) * MathHelper.cos(this.bipedBody.rotateAngleZ) * 12.0F +
-MathHelper.cos(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleZ) * 12.0F;
this.bipedRightLeg.rotationPointY =
MathHelper.cos(this.bipedBody.rotateAngleX) * MathHelper.cos(this.bipedBody.rotateAngleZ) * 12.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleY) * MathHelper.sin(this.bipedBody.rotateAngleZ) * 12.0F;
this.bipedRightLeg.rotationPointZ =
MathHelper.sin(this.bipedBody.rotateAngleY) * 2.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.cos(this.bipedBody.rotateAngleY) * 12.0F;
this.bipedLeftLeg.rotationPointX =
MathHelper.cos(this.bipedBody.rotateAngleY) * 2.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleY) * MathHelper.cos(this.bipedBody.rotateAngleZ) * 12.0F +
-MathHelper.cos(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleZ) * 12.0F;
this.bipedLeftLeg.rotationPointY =
MathHelper.cos(this.bipedBody.rotateAngleX) * MathHelper.cos(this.bipedBody.rotateAngleZ) * 12.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.sin(this.bipedBody.rotateAngleY) * MathHelper.sin(this.bipedBody.rotateAngleZ) * 12.0F;
this.bipedLeftLeg.rotationPointZ =
-MathHelper.sin(this.bipedBody.rotateAngleY) * 2.0F +
MathHelper.sin(this.bipedBody.rotateAngleX) * MathHelper.cos(this.bipedBody.rotateAngleY) * 12.0F;
this.addInterpolatedOffset(job,bipedHead,job.head);
this.addInterpolatedOffset(job,bipedHeadwear,job.head);
this.addInterpolatedOffset(job,bipedBody,job.body);
this.addInterpolatedOffset(job,bipedBodywear,job.body);
this.addInterpolatedOffset(job,bipedLeftArm,job.larm);
this.addInterpolatedOffset(job,bipedLeftArmwear,job.larm);
this.addInterpolatedOffset(job,bipedRightArm,job.rarm);
this.addInterpolatedOffset(job,bipedRightArmWear,job.rarm);
this.addInterpolatedOffset(job,bipedLeftLeg,job.lleg);
this.addInterpolatedOffset(job,bipedLeftLegWear,job.lleg);
this.addInterpolatedOffset(job,bipedRightLeg,job.rleg);
this.addInterpolatedOffset(job,bipedRightLegWear,job.rleg);
job.bipedRotsHead = new float[]{bipedHead.rotateAngleX,bipedHead.rotateAngleY,bipedHead.rotateAngleZ};
job.bipedRotsBody = new float[]{bipedBody.rotateAngleX,bipedBody.rotateAngleY,bipedBody.rotateAngleZ};
@@ -598,6 +629,21 @@ public class ModelMPM extends ModelNPCMale{
}
}
public void addInterpolatedOffset(JobPuppet job, ModelRenderer modelPart, JobPuppet.PartConfig puppetPart) {
if (!job.animate) {
modelPart.rotationPointX += puppetPart.pivotX;
modelPart.rotationPointY += puppetPart.pivotY;
modelPart.rotationPointZ += puppetPart.pivotZ;
} else {
modelPart.rotationPointX += puppetPart.prevPivotX;
modelPart.rotationPointY += puppetPart.prevPivotY;
modelPart.rotationPointZ += puppetPart.prevPivotZ;
puppetPart.prevPivotX = (puppetPart.pivotX - puppetPart.prevPivotX) * job.animRate /10f + puppetPart.prevPivotX;
puppetPart.prevPivotY = (puppetPart.pivotY - puppetPart.prevPivotY) * job.animRate /10f + puppetPart.prevPivotY;
puppetPart.prevPivotZ = (puppetPart.pivotZ - puppetPart.prevPivotZ) * job.animRate /10f + puppetPart.prevPivotZ;
}
}
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{