// Copyright (C) 2007 Id Software, Inc. // #ifndef __PHYSICS_ACTOR_H__ #define __PHYSICS_ACTOR_H__ #include "Physics_Base.h" /* =================================================================================== Actor physics base class An actor typically uses one collision model which is aligned with the gravity direction. The collision model is usually a simple box with the origin at the bottom center. =================================================================================== */ class idPhysics_Actor : public idPhysics_Base { public: CLASS_PROTOTYPE( idPhysics_Actor ); idPhysics_Actor( void ); ~idPhysics_Actor( void ); // get delta yaw of master float GetMasterDeltaYaw( void ) const; // returns the ground entity idEntity * GetGroundEntity( void ) const; // align the clip model with the gravity direction void SetClipModelAxis( void ); public: // common physics interface void SetClipModel( idClipModel *model, float density, int id = 0, bool freeOld = true ); idClipModel * GetClipModel( int id = 0 ) const; int GetNumClipModels( void ) const; void SetMass( float mass, int id = -1 ); float GetMass( int id = -1 ) const; void SetContents( int contents, int id = -1 ); int GetContents( int id = -1 ) const; const idBounds & GetBounds( int id = -1 ) const; const idBounds & GetAbsBounds( int id = -1 ) const; bool IsPushable( void ) const; const idVec3 & GetOrigin( int id = 0 ) const; const idMat3 & GetAxis( int id = 0 ) const; void SetGravity( const idVec3 &newGravity ); const idMat3 & GetGravityAxis( void ) const; void ClipTranslation( trace_t &results, const idVec3 &translation, const idClipModel *model ) const; void ClipRotation( trace_t &results, const idRotation &rotation, const idClipModel *model ) const; int ClipContents( const idClipModel *model ) const; void UnlinkClip( void ); void LinkClip( void ); void DisableClip( bool activateContacting = true ); void EnableClip( void ); bool EvaluateContacts( CLIP_DEBUG_PARMS_DECLARATION_ONLY ); // vehicle pushing stuff - Actors tend to have physics that // doesn't play nice with rigid body physics, so it needs to // be "pushed" enum vehiclePushResult_t { VPUSH_OK = 0, VPUSH_BLOCKED }; virtual int VehiclePush( bool stuck, float timeDelta, idVec3& move, idClipModel* pusher, int pushCount ) { return VPUSH_BLOCKED; } protected: idClipModel * clipModel; // clip model used for collision detection idMat3 clipModelAxis; // axis of clip model aligned with gravity direction // derived properties float mass; float invMass; // master idEntity * masterEntity; float masterYaw; float masterDeltaYaw; // results of last evaluate idEntityPtr groundEntityPtr; }; #endif /* !__PHYSICS_ACTOR_H__ */