mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-09 21:44:54 +00:00
Rotate thrown projectiles around the bb center
This commit is contained in:
parent
38bda3bd71
commit
d0a299caab
@ -4,6 +4,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <osg/PositionAttitudeTransform>
|
#include <osg/PositionAttitudeTransform>
|
||||||
|
#include <osg/ComputeBoundsVisitor>
|
||||||
|
|
||||||
#include <components/esm/esmwriter.hpp>
|
#include <components/esm/esmwriter.hpp>
|
||||||
#include <components/esm/projectilestate.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::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)
|
if (state.mIdMagic.size() > 1)
|
||||||
for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter)
|
for (size_t iter = 1; iter != state.mIdMagic.size(); ++iter)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user