improved dog leg animation

This commit is contained in:
Zeno Rogue 2019-05-16 17:22:04 +02:00
parent fc7100bbf1
commit cdb85d5edf
2 changed files with 35 additions and 3 deletions

View File

@ -18,6 +18,10 @@ ld eyepos;
hyperpoint shcenter;
hyperpoint front_leg, rear_leg;
transmatrix front_leg_move, rear_leg_move, front_leg_move_inverse, rear_leg_move_inverse;
ld leg_length;
vector<hyperpoint> get_shape(hpcshape sh) {
vector<hyperpoint> res;
for(int i=sh.s; i<sh.e-1; i++) res.push_back(hpc[i]);
@ -927,6 +931,19 @@ void make_3d_models() {
make_foot_3d(shYetiFoot);
make_skeletal(shSkeletalFoot, WDIM == 2 ? zc(0.5) + geom3::human_height/40 - geom3::FLOOR : 0);
hyperpoint front_leg = Hypc;
hyperpoint rear_leg = Hypc;
using namespace hyperpoint_vec;
for(int i=shDogFrontPaw.s; i<shDogFrontPaw.e; i++) front_leg += hpc[i];
for(int i=shDogRearPaw.s; i<shDogRearPaw.e; i++) rear_leg += hpc[i];
front_leg = normalize(front_leg);
rear_leg = normalize(rear_leg);
front_leg_move = zpush(zc(0.4)) * rgpushxto0(front_leg);
front_leg_move_inverse = inverse(front_leg_move);
rear_leg_move = zpush(zc(0.4)) * rgpushxto0(rear_leg);
rear_leg_move_inverse = inverse(rear_leg_move);
leg_length = zc(0.4) - zc(0);
make_paw_3d(shWolfFrontPaw, shWolfFrontLeg);
make_paw_3d(shWolfRearPaw, shWolfRearLeg);
make_paw_3d(shDogFrontPaw, shDogFrontLeg);

View File

@ -549,8 +549,23 @@ void animallegs(const transmatrix& V, eMonster mo, color_t col, double footphase
};
hpcshape **x = sh[mo == moRagingBull ? 5 : mo == moBug0 ? 3 : mo == moMetalBeast ? 4 : mo == moRunDog ? 0 : mo == moReptile ? 2 : 1];
if(GDIM == 3) {
queuepolyat(V * front_leg_move * cspin(0, 2, rightfoot / leg_length) * front_leg_move_inverse, *x[0], col, PPR::MONSTER_FOOT);
queuepolyat(V * Mirror * front_leg_move * cspin(0, 2, leftfoot / leg_length) * front_leg_move_inverse, *x[0], col, PPR::MONSTER_FOOT);
queuepolyat(V * rear_leg_move * cspin(0, 2, -rightfoot / leg_length) * rear_leg_move_inverse, *x[1], col, PPR::MONSTER_FOOT);
queuepolyat(V * Mirror * rear_leg_move * cspin(0, 2, -leftfoot / leg_length) * rear_leg_move_inverse, *x[1], col, PPR::MONSTER_FOOT);
return;
const transmatrix VL = (GDIM == 3 ? V : mmscale(V, geom3::ALEG0));
/*
if(WDIM == 2) V1 = V1 * zpush(geom3::GROIN);
Tright = V1 * cspin(0, 2, rightfoot/SCALE * 3);
Tleft = V1 * Mirror * cspin(2, 0, rightfoot/SCALE * 3);
if(WDIM == 2) Tleft = Tleft * zpush(-geom3::GROIN), Tright = Tright * zpush(-geom3::GROIN);
*/
}
const transmatrix VL = mmscale(V, geom3::ALEG0);
if(x[0]) queuepolyat(VL * xpush(rightfoot), *x[0], col, PPR::MONSTER_FOOT);
if(x[0]) queuepolyat(VL * Mirror * xpush(leftfoot), *x[0], col, PPR::MONSTER_FOOT);
@ -650,8 +665,8 @@ transmatrix otherbodyparts(const transmatrix& V, color_t col, eMonster who, doub
else {
transmatrix V1 = V;
if(WDIM == 2) V1 = V1 * zpush(geom3::GROIN);
Tright = V1 * cspin(0, 2, rightfoot/SCALE * 3);
Tleft = V1 * Mirror * cspin(2, 0, rightfoot/SCALE * 3);
Tright = V1 * cspin(0, 2, rightfoot/ leg_length);
Tleft = V1 * Mirror * cspin(2, 0, rightfoot / leg_length);
if(WDIM == 2) Tleft = Tleft * zpush(-geom3::GROIN), Tright = Tright * zpush(-geom3::GROIN);
}