forked from mirror/openmw-tes3mp
Apply the rotation when updating the character controller
This commit is contained in:
parent
466c0086b8
commit
7b02ec411b
5 changed files with 22 additions and 1 deletions
|
@ -416,7 +416,12 @@ namespace MWClass
|
|||
{
|
||||
return Ogre::Vector3(getMovementSettings(ptr).mPosition);
|
||||
}
|
||||
|
||||
|
||||
Ogre::Vector3 Npc::getRotationVector (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return Ogre::Vector3(getMovementSettings(ptr).mRotation);
|
||||
}
|
||||
|
||||
bool Npc::isEssential (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
|
|
|
@ -96,6 +96,9 @@ namespace MWClass
|
|||
///< Return desired movement vector (determined based on movement settings,
|
||||
/// stance and stats).
|
||||
|
||||
virtual Ogre::Vector3 getRotationVector (const MWWorld::Ptr& ptr) const;
|
||||
///< Return desired rotations, as euler angles.
|
||||
|
||||
virtual float getCapacity (const MWWorld::Ptr& ptr) const;
|
||||
///< Return total weight that fits into the object. Throws an exception, if the object can't
|
||||
/// hold other objects.
|
||||
|
|
|
@ -183,6 +183,7 @@ void CharacterController::update(float duration, Movement &movement)
|
|||
bool isrunning = cls.getStance(mPtr, MWWorld::Class::Run);
|
||||
bool sneak = cls.getStance(mPtr, MWWorld::Class::Sneak);
|
||||
const Ogre::Vector3 &vec = cls.getMovementVector(mPtr);
|
||||
const Ogre::Vector3 &rot = cls.getRotationVector(mPtr);
|
||||
speed = cls.getSpeed(mPtr);
|
||||
|
||||
/* FIXME: The state should be set to Jump, and X/Y movement should be disallowed except
|
||||
|
@ -232,6 +233,10 @@ void CharacterController::update(float duration, Movement &movement)
|
|||
}
|
||||
else if(mAnimQueue.size() == 0)
|
||||
setState((inwater ? CharState_IdleSwim : (sneak ? CharState_IdleSneak : CharState_Idle)), true);
|
||||
|
||||
movement.mRotation[0] += rot.x * duration;
|
||||
movement.mRotation[1] += rot.y * duration;
|
||||
movement.mRotation[2] += rot.z * duration;
|
||||
}
|
||||
|
||||
if(mAnimation && !mSkipAnim)
|
||||
|
|
|
@ -142,6 +142,11 @@ namespace MWWorld
|
|||
return Ogre::Vector3 (0, 0, 0);
|
||||
}
|
||||
|
||||
Ogre::Vector3 Class::getRotationVector (const Ptr& ptr) const
|
||||
{
|
||||
return Ogre::Vector3 (0, 0, 0);
|
||||
}
|
||||
|
||||
std::pair<std::vector<int>, bool> Class::getEquipmentSlots (const Ptr& ptr) const
|
||||
{
|
||||
return std::make_pair (std::vector<int>(), false);
|
||||
|
|
|
@ -150,6 +150,9 @@ namespace MWWorld
|
|||
///< Return desired movement vector (determined based on movement settings,
|
||||
/// stance and stats).
|
||||
|
||||
virtual Ogre::Vector3 getRotationVector (const Ptr& ptr) const;
|
||||
///< Return desired rotations, as euler angles.
|
||||
|
||||
virtual std::pair<std::vector<int>, bool> getEquipmentSlots (const Ptr& ptr) const;
|
||||
///< \return first: Return IDs of the slot this object can be equipped in; second: can object
|
||||
/// stay stacked when equipped?
|
||||
|
|
Loading…
Reference in a new issue