1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 01:15:33 +00:00

Rotate thrown projectiles around the bb center

This commit is contained in:
Miloslav Číž 2017-11-23 20:02:12 +01:00
parent 38bda3bd71
commit d0a299caab

View file

@ -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)
{