Added Elytra and Ears to animations
This commit is contained in:
parent
03c1b75a7c
commit
dfa779f6b8
|
@ -135,6 +135,7 @@ export class RootAnimation extends CompositeAnimation implements AnimationHandle
|
||||||
|
|
||||||
export const WalkingAnimation: Animation = (player, time) => {
|
export const WalkingAnimation: Animation = (player, time) => {
|
||||||
const skin = player.skin;
|
const skin = player.skin;
|
||||||
|
const ears = player.ears;
|
||||||
|
|
||||||
// Multiply by animation's natural speed
|
// Multiply by animation's natural speed
|
||||||
time *= 8;
|
time *= 8;
|
||||||
|
@ -154,9 +155,14 @@ export const WalkingAnimation: Animation = (player, time) => {
|
||||||
skin.head.rotation.y = Math.sin(time / 4) * 0.2;
|
skin.head.rotation.y = Math.sin(time / 4) * 0.2;
|
||||||
skin.head.rotation.x = Math.sin(time / 5) * 0.1;
|
skin.head.rotation.x = Math.sin(time / 5) * 0.1;
|
||||||
|
|
||||||
|
// Ears should mirror head
|
||||||
|
ears.rotation.y = skin.head.rotation.y
|
||||||
|
ears.rotation.x = skin.head.rotation.x
|
||||||
|
|
||||||
// Always add an angle for cape around the x axis
|
// Always add an angle for cape around the x axis
|
||||||
const basicCapeRotationX = Math.PI * 0.06;
|
const basicCapeRotationX = Math.PI * 0.06;
|
||||||
player.cape.rotation.x = Math.sin(time / 1.5) * 0.06 + basicCapeRotationX;
|
player.cape.rotation.x = Math.sin(time / 1.5) * 0.06 + basicCapeRotationX;
|
||||||
|
player.elytra.rotation.x = player.cape.rotation.x
|
||||||
};
|
};
|
||||||
|
|
||||||
export const RunningAnimation: Animation = (player, time) => {
|
export const RunningAnimation: Animation = (player, time) => {
|
||||||
|
@ -187,6 +193,7 @@ export const RunningAnimation: Animation = (player, time) => {
|
||||||
// to cape when running.
|
// to cape when running.
|
||||||
const basicCapeRotationX = Math.PI * 0.3;
|
const basicCapeRotationX = Math.PI * 0.3;
|
||||||
player.cape.rotation.x = Math.sin(time * 2) * 0.1 + basicCapeRotationX;
|
player.cape.rotation.x = Math.sin(time * 2) * 0.1 + basicCapeRotationX;
|
||||||
|
player.elytra.rotation.x = player.cape.rotation.x
|
||||||
|
|
||||||
// What about head shaking?
|
// What about head shaking?
|
||||||
// You shouldn't glance right and left when running dude :P
|
// You shouldn't glance right and left when running dude :P
|
||||||
|
|
Loading…
Reference in New Issue