Rotate thrown projectiles around the bb center

pull/1563/head
Miloslav Číž 7 years ago
parent 38bda3bd71
commit d0a299caab

@ -4,6 +4,7 @@
#include <iostream>
#include <osg/PositionAttitudeTransform>
#include <osg/ComputeBoundsVisitor>
#include <components/esm/esmwriter.hpp>
#include <components/esm/projectilestate.hpp>
@ -202,6 +203,12 @@ namespace MWWorld
osg::ref_ptr<osg::Node> projectile = mResourceSystem->getSceneManager()->getInstance(model, attachTo);
osg::ref_ptr<osg::ComputeBoundsVisitor> boundVisitor = new osg::ComputeBoundsVisitor();
projectile->accept(*boundVisitor.get());
osg::BoundingBox bb = boundVisitor->getBoundingBox();
state.mNode->setPivotPoint(bb.center());
if (state.mIdMagic.size() > 1)
for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter)
{

Loading…
Cancel
Save