Fix placement and improve animations

This commit is contained in:
Sollace 2018-06-08 01:05:16 +02:00
parent 03b558bb8f
commit 3800bc2424
3 changed files with 29 additions and 12 deletions

View file

@ -18,7 +18,7 @@ public class ModelWing {
}
private void addClosedWing(float x, float y, float scale) {
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y, WING_FOLDED_RP_Z)
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
.box(x, 5, 2, 2, 6, 2, scale)
.box(x, 5, 4, 2, 8, 2, scale)
.box(x, 5, 6, 2, 6, 2, scale)
@ -28,15 +28,15 @@ public class ModelWing {
private void addFeathers(boolean mirror, float y, float scale) {
float r = mirror ? -1 : 1;
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + y, LEFT_WING_EXT_RP_Z);
addFeather(0, r, y, 6, 0, 8, scale + 0.1F);
addFeather(1, r, y, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
addFeather(2, r, y, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
addFeather(3, r, y, 5, 2, 8, scale) .rotateAngleX = -0.5F;
addFeather(4, r, y, 0, -0.2F, 6, scale + 0.3F);
addFeather(5, r, y, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
addFeather(0, r, 6, 0, 8, scale + 0.1F);
addFeather(1, r, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
addFeather(2, r, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
addFeather(3, r, 5, 2, 8, scale) .rotateAngleX = -0.5F;
addFeather(4, r, 0, -0.2F, 6, scale + 0.3F);
addFeather(5, r, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
}
private PonyRenderer addFeather(int i, float r, float Y, float y, float z, int h, float scale) {
private PonyRenderer addFeather(int i, float r, float y, float z, int h, float scale) {
return extended.child(i).around(0, 0, 0).box(-0.5f, y, z, 1, h, 2, scale);
}

View file

@ -50,7 +50,7 @@ public class PegasusWings implements IModelPart {
} else {
float pi = PI * (float) Math.pow(swing, 16);
float mve = move * 0.6662f; // magic number ahoy
float mve = move * 0.6662f; // magic number ahoy (actually 2/3)
float srt = swing / 4;
flap = MathHelper.cos(mve + pi) * srt;
@ -61,6 +61,9 @@ public class PegasusWings implements IModelPart {
if (pegasus.wingsAreOpen()) {
float flapAngle = pegasus.getWingRotationFactor(ticks);
if (pegasus.isWearing(PonyWearable.SADDLE_BAGS)) {
flapAngle -= 0.6F;
}
getLeft().rotateFlying(flapAngle);
getRight().rotateFlying(-flapAngle);
}

View file

@ -4,6 +4,7 @@ import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPart;
import com.minelittlepony.model.capabilities.IModelPegasus;
import com.minelittlepony.render.plane.PlaneRenderer;
import net.minecraft.client.renderer.GlStateManager;
@ -18,7 +19,12 @@ public class SaddleBags implements IModelPart {
private boolean hangLow = false;
float dropAmount = 0;
AbstractPonyModel model;
public SaddleBags(AbstractPonyModel model) {
this.model = model;
leftBag = new PlaneRenderer(model, 56, 19);
rightBag = new PlaneRenderer(model, 56, 19);
strap = new PlaneRenderer(model, 56, 19);
@ -28,7 +34,7 @@ public class SaddleBags implements IModelPart {
public void init(float yOffset, float stretch) {
float y = -0.5F;
int x = 4;
int z = -2;
int z = -1;
strap.offset(-x, y + 0.2F, z + 3).around(0, 4, 4)
.tex(56, 31).addTopPlane(0, 0, 0, 8, 1, stretch)
@ -66,15 +72,23 @@ public class SaddleBags implements IModelPart {
float pi = PI * (float) Math.pow(swing, 16);
float mve = move * 0.6662f;
float srt = swing / 6;
float srt = swing / 10;
bodySwing = MathHelper.cos(mve + pi) * srt;
leftBag.rotateAngleX = bodySwing;
rightBag.rotateAngleX = bodySwing;
if (model instanceof IModelPegasus && model.isFlying()) {
bodySwing = ((IModelPegasus)model).getWingRotationFactor(ticks) - ROTATE_270;
bodySwing /= 10;
}
leftBag.rotateAngleZ = bodySwing;
rightBag.rotateAngleZ = -bodySwing;
// TODO: Interpolate
dropAmount = (hangLow ? 0.15F : 0) * model.getSwingAmount();
}
public void sethangingLow(boolean veryLow) {
@ -85,7 +99,7 @@ public class SaddleBags implements IModelPart {
public void renderPart(float scale) {
if (hangLow) {
GlStateManager.pushMatrix();
GlStateManager.translate(0, 0.3F, 0);
GlStateManager.translate(0, dropAmount, 0);
}
leftBag.render(scale);