mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-15 18:39:51 +00:00
Rotate the neck when looking up and down in first-person
This commit is contained in:
parent
4df1f198a7
commit
2d7620e774
@ -45,6 +45,7 @@ void Animation::destroyObjectList(Ogre::SceneManager *sceneMgr, NifOgre::ObjectL
|
|||||||
|
|
||||||
Animation::Animation(const MWWorld::Ptr &ptr)
|
Animation::Animation(const MWWorld::Ptr &ptr)
|
||||||
: mPtr(ptr)
|
: mPtr(ptr)
|
||||||
|
, mCamera(NULL)
|
||||||
, mInsert(NULL)
|
, mInsert(NULL)
|
||||||
, mSkelBase(NULL)
|
, mSkelBase(NULL)
|
||||||
, mAccumRoot(NULL)
|
, mAccumRoot(NULL)
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
|
class Camera;
|
||||||
|
|
||||||
class Animation
|
class Animation
|
||||||
{
|
{
|
||||||
@ -80,6 +81,7 @@ protected:
|
|||||||
typedef std::map<std::string,AnimState> AnimStateMap;
|
typedef std::map<std::string,AnimState> AnimStateMap;
|
||||||
|
|
||||||
MWWorld::Ptr mPtr;
|
MWWorld::Ptr mPtr;
|
||||||
|
Camera *mCamera;
|
||||||
|
|
||||||
Ogre::SceneNode *mInsert;
|
Ogre::SceneNode *mInsert;
|
||||||
Ogre::Entity *mSkelBase;
|
Ogre::Entity *mSkelBase;
|
||||||
@ -210,6 +212,9 @@ public:
|
|||||||
|
|
||||||
virtual void showWeapons(bool showWeapon);
|
virtual void showWeapons(bool showWeapon);
|
||||||
|
|
||||||
|
void setCamera(Camera *cam)
|
||||||
|
{ mCamera = cam; }
|
||||||
|
|
||||||
Ogre::Node *getNode(const std::string &name);
|
Ogre::Node *getNode(const std::string &name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -283,10 +283,14 @@ namespace MWRender
|
|||||||
// If we're switching to a new NpcAnimation, ensure the old one is
|
// If we're switching to a new NpcAnimation, ensure the old one is
|
||||||
// using a normal view mode
|
// using a normal view mode
|
||||||
if(mAnimation && mAnimation != anim)
|
if(mAnimation && mAnimation != anim)
|
||||||
|
{
|
||||||
mAnimation->setViewMode(NpcAnimation::VM_Normal);
|
mAnimation->setViewMode(NpcAnimation::VM_Normal);
|
||||||
|
mAnimation->setCamera(NULL);
|
||||||
|
}
|
||||||
mAnimation = anim;
|
mAnimation = anim;
|
||||||
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
mAnimation->setViewMode(isFirstPerson() ? NpcAnimation::VM_FirstPerson :
|
||||||
NpcAnimation::VM_Normal);
|
NpcAnimation::VM_Normal);
|
||||||
|
mAnimation->setCamera(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::setHeight(float height)
|
void Camera::setHeight(float height)
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
|
||||||
#include "renderconst.hpp"
|
#include "renderconst.hpp"
|
||||||
|
#include "camera.hpp"
|
||||||
|
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
@ -415,6 +416,13 @@ Ogre::Vector3 NpcAnimation::runAnimation(float timepassed)
|
|||||||
Ogre::Vector3 ret = Animation::runAnimation(timepassed);
|
Ogre::Vector3 ret = Animation::runAnimation(timepassed);
|
||||||
|
|
||||||
Ogre::SkeletonInstance *baseinst = mSkelBase->getSkeleton();
|
Ogre::SkeletonInstance *baseinst = mSkelBase->getSkeleton();
|
||||||
|
if(mViewMode == VM_FirstPerson && mCamera)
|
||||||
|
{
|
||||||
|
float pitch = mCamera->getPitch();
|
||||||
|
Ogre::Node *node = baseinst->getBone("Bip01 Neck");
|
||||||
|
node->pitch(Ogre::Radian(pitch*0.75f), Ogre::Node::TS_WORLD);
|
||||||
|
}
|
||||||
|
|
||||||
for(size_t i = 0;i < sPartListSize;i++)
|
for(size_t i = 0;i < sPartListSize;i++)
|
||||||
{
|
{
|
||||||
Ogre::Entity *ent = mObjectParts[i].mSkelBase;
|
Ogre::Entity *ent = mObjectParts[i].mSkelBase;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user