Make use of mEffectAnimationTime for projectile rotation

pull/347/head
Miloslav Číž 7 years ago
parent 2b9a0a7732
commit 3dbcda6686

@ -317,7 +317,6 @@ namespace MWWorld
state.mCasterHandle = actor; state.mCasterHandle = actor;
state.mAttackStrength = attackStrength; state.mAttackStrength = attackStrength;
state.mThrown = projectile.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown; state.mThrown = projectile.get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::MarksmanThrown;
state.mTime = 0.0;
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), projectile.getCellRef().getRefId()); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), projectile.getCellRef().getRefId());
MWWorld::Ptr ptr = ref.getPtr(); MWWorld::Ptr ptr = ref.getPtr();
@ -455,7 +454,6 @@ namespace MWWorld
// gravity constant - must be way lower than the gravity affecting actors, since we're not // gravity constant - must be way lower than the gravity affecting actors, since we're not
// simulating aerodynamics at all // simulating aerodynamics at all
it->mVelocity -= osg::Vec3f(0, 0, 627.2f * 0.1f) * duration; it->mVelocity -= osg::Vec3f(0, 0, 627.2f * 0.1f) * duration;
it->mTime += duration;
osg::Vec3f pos(it->mNode->getPosition()); osg::Vec3f pos(it->mNode->getPosition());
osg::Vec3f newPos = pos + it->mVelocity * duration; osg::Vec3f newPos = pos + it->mVelocity * duration;
@ -463,7 +461,7 @@ namespace MWWorld
osg::Quat orient; osg::Quat orient;
orient.set( orient.set(
osg::Matrixd::rotate(it->mThrown ? -1 * it->mTime : 0.0,osg::Vec3f(0,0,1)) * osg::Matrixd::rotate(it->mThrown ? -1 * it->mEffectAnimationTime->getTime() * 10.0 : 0.0,osg::Vec3f(0,0,1)) *
osg::Matrixd::rotate(osg::PI / 2.0,osg::Vec3f(0,1,0)) * osg::Matrixd::rotate(osg::PI / 2.0,osg::Vec3f(0,1,0)) *
osg::Matrixd::rotate(-1 * osg::PI / 2.0,osg::Vec3f(1,0,0)) * osg::Matrixd::rotate(-1 * osg::PI / 2.0,osg::Vec3f(1,0,0)) *
osg::Matrixd::inverse( osg::Matrixd::inverse(
@ -568,7 +566,6 @@ namespace MWWorld
state.mAttackStrength = it->mAttackStrength; state.mAttackStrength = it->mAttackStrength;
state.mThrown = it->mThrown; state.mThrown = it->mThrown;
state.mTime = it->mTime;
state.save(writer); state.save(writer);
@ -608,7 +605,6 @@ namespace MWWorld
state.mIdArrow = esm.mId; state.mIdArrow = esm.mId;
state.mAttackStrength = esm.mAttackStrength; state.mAttackStrength = esm.mAttackStrength;
state.mThrown = esm.mThrown; state.mThrown = esm.mThrown;
state.mTime = esm.mTime;
std::string model; std::string model;
try try

@ -112,7 +112,6 @@ namespace MWWorld
osg::Vec3f mVelocity; osg::Vec3f mVelocity;
float mAttackStrength; float mAttackStrength;
float mTime;
bool mThrown; bool mThrown;
}; };

@ -53,7 +53,6 @@ namespace ESM
esm.writeHNT ("VEL_", mVelocity); esm.writeHNT ("VEL_", mVelocity);
esm.writeHNT ("STR_", mAttackStrength); esm.writeHNT ("STR_", mAttackStrength);
esm.writeHNT ("THR_", mThrown); esm.writeHNT ("THR_", mThrown);
esm.writeHNT ("TIM_", mTime);
} }
void ProjectileState::load(ESMReader &esm) void ProjectileState::load(ESMReader &esm)
@ -68,9 +67,6 @@ namespace ESM
mThrown = false; mThrown = false;
esm.getHNOT (mThrown, "THR_"); esm.getHNOT (mThrown, "THR_");
mTime = 0.f;
esm.getHNOT (mTime, "TIM_");
} }
} }

@ -42,7 +42,6 @@ namespace ESM
std::string mBowId; std::string mBowId;
Vector3 mVelocity; Vector3 mVelocity;
float mAttackStrength; float mAttackStrength;
float mTime;
bool mThrown; bool mThrown;
void load (ESMReader &esm); void load (ESMReader &esm);

Loading…
Cancel
Save