OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
MWPhysics::Actor Class Reference

#include <actor.hpp>

Inheritance diagram for MWPhysics::Actor:
Collaboration diagram for MWPhysics::Actor:

Public Member Functions

 Actor (const MWWorld::Ptr &ptr, osg::ref_ptr< const Resource::BulletShape > shape, btCollisionWorld *world)
 
 ~Actor ()
 
void enableCollisionMode (bool collision)
 
bool getCollisionMode () const
 
void enableCollisionBody (bool collision)
 
void updateScale ()
 
void updateRotation ()
 
void updatePosition ()
 
void updateCollisionObjectPosition ()
 
osg::Vec3f getHalfExtents () const
 
osg::Vec3f getCollisionObjectPosition () const
 
void setPosition (const osg::Vec3f &position)
 
osg::Vec3f getPosition () const
 
osg::Vec3f getPreviousPosition () const
 
osg::Vec3f getRenderingHalfExtents () const
 
void setInertialForce (const osg::Vec3f &force)
 
const osg::Vec3f & getInertialForce () const
 
void setOnGround (bool grounded)
 
bool getOnGround () const
 
btCollisionObject * getCollisionObject () const
 
void setCanWaterWalk (bool waterWalk)
 Sets whether this actor should be able to collide with the water surface. More...
 
void setWalkingOnWater (bool walkingOnWater)
 Sets whether this actor has been walking on the water surface in the last frame. More...
 
bool isWalkingOnWater () const
 
- Public Member Functions inherited from MWPhysics::PtrHolder
virtual ~PtrHolder ()
 
void updatePtr (const MWWorld::Ptr &updated)
 
MWWorld::Ptr getPtr ()
 
MWWorld::ConstPtr getPtr () const
 

Private Member Functions

void updateCollisionMask ()
 Removes then re-adds the collision object to the dynamics world. More...
 
void addCollisionMask (int collisionMask)
 
int getCollisionMask ()
 
 Actor (const Actor &)
 
Actoroperator= (const Actor &)
 

Private Attributes

bool mCanWaterWalk
 
bool mWalkingOnWater
 
std::auto_ptr< btCollisionShape > mShape
 
std::auto_ptr< btCollisionObject > mCollisionObject
 
osg::Vec3f mMeshTranslation
 
osg::Vec3f mHalfExtents
 
osg::Quat mRotation
 
osg::Vec3f mScale
 
osg::Vec3f mRenderingScale
 
osg::Vec3f mPosition
 
osg::Vec3f mPreviousPosition
 
osg::Vec3f mForce
 
bool mOnGround
 
bool mInternalCollisionMode
 
bool mExternalCollisionMode
 
btCollisionWorld * mCollisionWorld
 

Additional Inherited Members

- Protected Attributes inherited from MWPhysics::PtrHolder
MWWorld::Ptr mPtr
 

Constructor & Destructor Documentation

MWPhysics::Actor::Actor ( const MWWorld::Ptr ptr,
osg::ref_ptr< const Resource::BulletShape shape,
btCollisionWorld *  world 
)

Here is the call graph for this function:

MWPhysics::Actor::~Actor ( )
MWPhysics::Actor::Actor ( const Actor )
private

Member Function Documentation

void MWPhysics::Actor::addCollisionMask ( int  collisionMask)
private

Here is the caller graph for this function:

void MWPhysics::Actor::enableCollisionBody ( bool  collision)

Enables or disables the external collision body. If disabled, other actors will not collide with this actor.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::enableCollisionMode ( bool  collision)

Sets the collisionMode for this actor. If disabled, the actor can fly and clip geometry.

int MWPhysics::Actor::getCollisionMask ( )
private

Here is the caller graph for this function:

bool MWPhysics::Actor::getCollisionMode ( ) const
inline

Here is the caller graph for this function:

btCollisionObject* MWPhysics::Actor::getCollisionObject ( ) const
inline

Here is the caller graph for this function:

osg::Vec3f MWPhysics::Actor::getCollisionObjectPosition ( ) const

Returns the position of the collision body

Note
The collision shape's origin is in its center, so the position returned can be described as center of the actor collision box in world space.

Here is the call graph for this function:

Here is the caller graph for this function:

osg::Vec3f MWPhysics::Actor::getHalfExtents ( ) const

Returns the half extents of the collision body (scaled according to collision scale)

Here is the caller graph for this function:

const osg::Vec3f& MWPhysics::Actor::getInertialForce ( ) const
inline

Gets the current amount of inertial force (incl. gravity) affecting this physic actor

Here is the caller graph for this function:

bool MWPhysics::Actor::getOnGround ( ) const
inline

Here is the caller graph for this function:

osg::Vec3f MWPhysics::Actor::getPosition ( ) const

Here is the caller graph for this function:

osg::Vec3f MWPhysics::Actor::getPreviousPosition ( ) const

Here is the caller graph for this function:

osg::Vec3f MWPhysics::Actor::getRenderingHalfExtents ( ) const

Returns the half extents of the collision body (scaled according to rendering scale)

Note
The reason we need this extra method is because of an inconsistency in MW - NPC race scales aren't applied to the collision shape, most likely to make environment collision testing easier. However in some cases (swimming level) we want the actual scale.

Here is the caller graph for this function:

bool MWPhysics::Actor::isWalkingOnWater ( ) const

Here is the caller graph for this function:

Actor& MWPhysics::Actor::operator= ( const Actor )
private
void MWPhysics::Actor::setCanWaterWalk ( bool  waterWalk)

Sets whether this actor should be able to collide with the water surface.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::setInertialForce ( const osg::Vec3f &  force)

Sets the current amount of inertial force (incl. gravity) affecting this physic actor

Here is the caller graph for this function:

void MWPhysics::Actor::setOnGround ( bool  grounded)

Here is the caller graph for this function:

void MWPhysics::Actor::setPosition ( const osg::Vec3f &  position)

Store the current position into mPreviousPosition, then move to this position.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::setWalkingOnWater ( bool  walkingOnWater)

Sets whether this actor has been walking on the water surface in the last frame.

Here is the caller graph for this function:

void MWPhysics::Actor::updateCollisionMask ( )
private

Removes then re-adds the collision object to the dynamics world.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::updateCollisionObjectPosition ( )

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::updatePosition ( )

Set mPosition and mPreviousPosition to the position in the Ptr's RefData. This should be used when an object is "instantly" moved/teleported as opposed to being moved by the physics simulation.

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::updateRotation ( )

Here is the call graph for this function:

Here is the caller graph for this function:

void MWPhysics::Actor::updateScale ( )

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

bool MWPhysics::Actor::mCanWaterWalk
private
std::auto_ptr<btCollisionObject> MWPhysics::Actor::mCollisionObject
private
btCollisionWorld* MWPhysics::Actor::mCollisionWorld
private
bool MWPhysics::Actor::mExternalCollisionMode
private
osg::Vec3f MWPhysics::Actor::mForce
private
osg::Vec3f MWPhysics::Actor::mHalfExtents
private
bool MWPhysics::Actor::mInternalCollisionMode
private
osg::Vec3f MWPhysics::Actor::mMeshTranslation
private
bool MWPhysics::Actor::mOnGround
private
osg::Vec3f MWPhysics::Actor::mPosition
private
osg::Vec3f MWPhysics::Actor::mPreviousPosition
private
osg::Vec3f MWPhysics::Actor::mRenderingScale
private
osg::Quat MWPhysics::Actor::mRotation
private
osg::Vec3f MWPhysics::Actor::mScale
private
std::auto_ptr<btCollisionShape> MWPhysics::Actor::mShape
private
bool MWPhysics::Actor::mWalkingOnWater
private

The documentation for this class was generated from the following files: