mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 21:40:15 +00:00
Correct projectile rotation
This commit is contained in:
parent
d0a299caab
commit
4373fea21e
@ -386,7 +386,6 @@ namespace MWWorld
|
|||||||
static float fTargetSpellMaxSpeed = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
static float fTargetSpellMaxSpeed = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||||
.find("fTargetSpellMaxSpeed")->getFloat();
|
.find("fTargetSpellMaxSpeed")->getFloat();
|
||||||
float speed = fTargetSpellMaxSpeed * it->mSpeed;
|
float speed = fTargetSpellMaxSpeed * it->mSpeed;
|
||||||
|
|
||||||
osg::Vec3f direction = orient * osg::Vec3f(0,1,0);
|
osg::Vec3f direction = orient * osg::Vec3f(0,1,0);
|
||||||
direction.normalize();
|
direction.normalize();
|
||||||
osg::Vec3f pos(it->mNode->getPosition());
|
osg::Vec3f pos(it->mNode->getPosition());
|
||||||
@ -466,18 +465,21 @@ namespace MWWorld
|
|||||||
osg::Vec3f newPos = pos + it->mVelocity * duration;
|
osg::Vec3f newPos = pos + it->mVelocity * duration;
|
||||||
|
|
||||||
osg::Quat orient;
|
osg::Quat orient;
|
||||||
|
|
||||||
orient.set(
|
if (it->mThrown)
|
||||||
osg::Matrixd::rotate(it->mThrown ? -1 * it->mEffectAnimationTime->getTime() * 10.0 : 0.0,osg::Vec3f(0,0,1)) *
|
orient.set(
|
||||||
osg::Matrixd::rotate(osg::PI / 2.0,osg::Vec3f(0,1,0)) *
|
osg::Matrixd::rotate(it->mEffectAnimationTime->getTime() * -10.0,osg::Vec3f(0,0,1)) *
|
||||||
osg::Matrixd::rotate(-1 * osg::PI / 2.0,osg::Vec3f(1,0,0)) *
|
osg::Matrixd::rotate(osg::PI / 2.0,osg::Vec3f(0,1,0)) *
|
||||||
osg::Matrixd::inverse(
|
osg::Matrixd::rotate(-1 * osg::PI / 2.0,osg::Vec3f(1,0,0)) *
|
||||||
osg::Matrixd::lookAt(
|
osg::Matrixd::inverse(
|
||||||
osg::Vec3f(0,0,0),
|
osg::Matrixd::lookAt(
|
||||||
it->mVelocity,
|
osg::Vec3f(0,0,0),
|
||||||
osg::Vec3f(0,0,1))
|
it->mVelocity,
|
||||||
)
|
osg::Vec3f(0,0,1))
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
else
|
||||||
|
orient.makeRotate(osg::Vec3f(0,1,0), it->mVelocity);
|
||||||
|
|
||||||
it->mNode->setAttitude(orient);
|
it->mNode->setAttitude(orient);
|
||||||
it->mNode->setPosition(newPos);
|
it->mNode->setPosition(newPos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user