mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Add proper flying animations to the lion's tail
This commit is contained in:
parent
1c0cdb60ff
commit
e80a27b531
3 changed files with 23 additions and 7 deletions
|
@ -75,6 +75,12 @@ public class ModelAttributes {
|
||||||
* Vertical pitch whilst flying.
|
* Vertical pitch whilst flying.
|
||||||
*/
|
*/
|
||||||
public float motionPitch;
|
public float motionPitch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Horizontal roll whilst flying.
|
||||||
|
*/
|
||||||
|
public float motionRoll;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lerp amount controlling leg swing whilst performing a rainboom.
|
* Lerp amount controlling leg swing whilst performing a rainboom.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -28,19 +28,25 @@ public class LionTail implements IPart {
|
||||||
Interpolator interpolator = Interpolator.linear(attributes.interpolatorId);
|
Interpolator interpolator = Interpolator.linear(attributes.interpolatorId);
|
||||||
|
|
||||||
float straightness = 1.6F * (1 + (float)Math.sin(ticks / speed) / 8F);
|
float straightness = 1.6F * (1 + (float)Math.sin(ticks / speed) / 8F);
|
||||||
float bend = (float)Math.sin(Math.PI/2F + 2 * ticks / speed) / 16F;
|
float twist = (float)Math.sin(Math.PI/2F + 2 * ticks / speed) / 16F;
|
||||||
|
float bend = attributes.motionRoll / 80F;
|
||||||
|
|
||||||
if (attributes.isCrouching) {
|
if (attributes.isCrouching) {
|
||||||
baseSail += 1;
|
baseSail += 1;
|
||||||
straightness += 0.5F;
|
straightness += 0.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attributes.isGoingFast) {
|
||||||
|
straightness *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
straightness = interpolator.interpolate("kirin_tail_straightness", straightness, 10);
|
straightness = interpolator.interpolate("kirin_tail_straightness", straightness, 10);
|
||||||
|
twist = interpolator.interpolate("kirin_tail_twist", twist, 10);
|
||||||
bend = interpolator.interpolate("kirin_tail_bendiness", bend, 10);
|
bend = interpolator.interpolate("kirin_tail_bendiness", bend, 10);
|
||||||
|
|
||||||
tail.pitch = baseSail;
|
tail.pitch = baseSail;
|
||||||
tail.pitch += swing / 2;
|
tail.pitch += swing / 2;
|
||||||
tail.yaw = bend;
|
tail.yaw = twist;
|
||||||
tail.roll = bodySwing * 2;
|
tail.roll = bodySwing * 2;
|
||||||
|
|
||||||
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
|
float sinTickFactor = MathHelper.sin(ticks * 0.067f) * 0.05f;
|
||||||
|
@ -49,7 +55,7 @@ public class LionTail implements IPart {
|
||||||
|
|
||||||
var tail2 = tail.getChild("tail2");
|
var tail2 = tail.getChild("tail2");
|
||||||
tail2.pitch = -(baseSail + sinTickFactor) / straightness;
|
tail2.pitch = -(baseSail + sinTickFactor) / straightness;
|
||||||
tail2.yaw = bend;
|
tail2.yaw = twist;
|
||||||
tail2.roll = bodySwing;
|
tail2.roll = bodySwing;
|
||||||
|
|
||||||
var tail3 = tail2.getChild("tail3");
|
var tail3 = tail2.getChild("tail3");
|
||||||
|
@ -71,6 +77,11 @@ public class LionTail implements IPart {
|
||||||
tail6.pitch = tail5.pitch * straightness;
|
tail6.pitch = tail5.pitch * straightness;
|
||||||
tail6.yaw = tail5.yaw;
|
tail6.yaw = tail5.yaw;
|
||||||
tail6.roll = -bodySwing * 2F;
|
tail6.roll = -bodySwing * 2F;
|
||||||
|
|
||||||
|
tail3.roll += bend;
|
||||||
|
tail4.roll += bend;
|
||||||
|
tail5.roll += bend;
|
||||||
|
tail6.roll += bend;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,12 +17,11 @@ public class PostureFlight extends MotionCompositor implements PonyPosture<Playe
|
||||||
@Override
|
@Override
|
||||||
public void transform(IModel model, PlayerEntity player, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
public void transform(IModel model, PlayerEntity player, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
|
||||||
model.getAttributes().motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ);
|
model.getAttributes().motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ);
|
||||||
|
model.getAttributes().motionRoll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
||||||
|
|
||||||
float roll = (float)calculateRoll(player, motionX, motionY, motionZ);
|
model.getAttributes().motionRoll = model.getMetadata().getInterpolator(model.getAttributes().interpolatorId).interpolate("pegasusRoll", model.getAttributes().motionRoll, 10);
|
||||||
|
|
||||||
roll = model.getMetadata().getInterpolator(player.getUuid()).interpolate("pegasusRoll", roll, 10);
|
|
||||||
|
|
||||||
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(model.getAttributes().motionPitch));
|
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(model.getAttributes().motionPitch));
|
||||||
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(roll));
|
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(model.getAttributes().motionRoll));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue