My Project
Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
ParaEngine::CBipedObject Class Reference

It can be used to represent biped object(like human, re spawning monsters) in the scene without inheriting and adding new functions. More...

#include <BipedObject.h>

Inheritance diagram for ParaEngine::CBipedObject:
ParaEngine::IGameObject ParaEngine::ShadowCaster ParaEngine::CTileObject ParaEngine::CBaseObject ParaEngine::IViewClippingObject ParaEngine::IHeadOn3D ParaEngine::IObjectScriptingInterface ParaEngine::IRefObject ParaEngine::IAttributeFields ParaEngine::IObject ParaEngine::CRefCounted ParaEngine::CRpgCharacter ParaEngine::CRpgCharacter ParaEngine::COPCBiped ParaEngine::COPCBiped

Public Types

enum  PhysicsMoveStyle {
  MOVESTYLE_SLIDINGWALL = 0, MOVESTYLE_HEIGHTONLY, MOVESTYLE_ABOVETERRAIN, MOVESTYLE_LINEAR,
  MOVESTYLE_OPC
}
 how the character reacts to physics in the MoveTowards() functions More...
 
enum  RenderSelectionStyle { RenderSelectionStyle_unlit = 0, RenderSelectionStyle_border = 1, RenderSelectionStyle_flash = 2 }
 how to render a selected object More...
 
typedef ParaEngine::weak_ptr< IObject, CBipedObjectWeakPtr_type
 
typedef std::list< BipedWayPointWayPointList_type
 
- Public Types inherited from ParaEngine::IGameObject
typedef ParaEngine::weak_ptr< IObject, IGameObjectWeakPtr_type
 
- Public Types inherited from ParaEngine::CBaseObject
enum  _SceneObjectType {
  BaseObject = 0, ContainerObject = 0x1, MeshObject = 0x1<<1, SkyMesh = 0x1<<2,
  BipedObject = 0x1<<3, SpriteObject = 0x1<<4, SceneRoot = 0x1<<5, OPCBiped = 0x1<<6,
  RPGBiped = 0x1<<7, MDXObject = 0x1<<8, MeshPhysicsObject = 0x1<<9, DynamicObject = 0x1<<10,
  ViewCullingObject = 0x1<<11, MissileObject = 0x1<<12, GameObject = 0x1<<13, LightObject = 0x1<<14,
  MiniSceneGraph = 0x1<<15, VoxelMesh = 0x1<<16, ManagedLoader = 0x1<<17, ZoneNode = 0x1<<18,
  PortalNode = 0x1<<19, AntiPortalNode = 0x1<<20, CadObject = 0x1<<21
}
 
enum  CallBackType {
  Type_EnterSentientArea =0, Type_LeaveSentientArea, Type_Click, Type_Event,
  Type_Perception, Type_FrameMove, Type_Net_Send, Type_Net_Receive,
  Type_OnLoadScript, Type_OnAssetLoaded, Type_Paint, Type_Unknown
}
 call back type
 
enum  NPL_STRING {
  NPL_CREATE = 0, NPL_CREATE_IN_LOADER = 0x1<<1, NPL_UPDATE = 0x1<<2, NPL_DELETE = 0x1<<3,
  NPL_DONOT_OUTPUT_ASSET = 0x1<<4
}
 by which method an object is converted to NPL string. More...
 
enum  CompressOption { ReleaseDevices = 1, ReleasePhysics = 2, ReleaseEvents = 4 }
 
typedef ParaEngine::weak_ptr< IObject, CBaseObjectWeakPtr_type
 
typedef unordered_ref_array< CBaseObject * > CChildObjectList_Type
 
typedef std::list< ObjectEventObjectEventList_Type
 
- Public Types inherited from ParaEngine::IAttributeFields
typedef ParaEngine::weak_ptr< IObject, IAttributeFieldsWeakPtr_type
 
- Public Types inherited from ParaEngine::IObject
typedef ParaEngine::weak_ptr< IObjectWeakPtr_type
 
- Public Types inherited from ParaEngine::IObjectScriptingInterface
typedef std::vector< ScriptCallbackObjectCallbackPool_Type
 

Public Member Functions

virtual std::string ToString (DWORD nMethod)
 convert the object to an NPL string by which this object may be created or deleted. More...
 
virtual CBaseObject::_SceneObjectType GetType ()
 
virtual int GetAttributeClassID ()
 attribute class ID should be identical, unless one knows how overriding rules work. More...
 
virtual const char * GetAttributeClassName ()
 a static string, describing the attribute class object's name
 
virtual const char * GetAttributeClassDescription ()
 a static string, describing the attribute class object
 
virtual int InstallFields (CAttributeClass *pClass, bool bOverride)
 this class should be implemented if one wants to add new attribute. More...
 
virtual IAttributeFieldsGetChildAttributeObject (const std::string &sName)
 get attribute by child object. More...
 
virtual int GetChildAttributeObjectCount (int nColumnIndex=0)
 get the number of child objects (row count) in the given column. More...
 
virtual int GetChildAttributeColumnCount ()
 we support multi-dimensional child object. More...
 
virtual IAttributeFieldsGetChildAttributeObject (int nRowIndex, int nColumnIndex=0)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetPhysicsRadius_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetPhysicsRadius_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetPhysicsHeight_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetPhysicsHeight_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetSizeScale_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetSizeScale_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetDensity_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetDensity_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetSpeedScale_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetSpeedScale_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetCurrentAnimation_s, int *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, PlayAnimation_s, int)
 
 ATTRIBUTE_METHOD (CBipedObject, DumpBVHAnimations_s)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetHeadTurningAngle_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetHeadTurningAngle_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetHeadUpdownAngle_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetHeadUpdownAngle_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetBootHeight_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetBootHeight_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetMovementStyle_s, int *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetMovementStyle_s, int)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetSpeed_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetSpeed_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetLastSpeed_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetLastSpeed_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetAccelerationDist_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetAccelerationDist_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetVerticalSpeed_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetVerticalSpeed_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetPhysicsGroupSensorMask_s, DWORD *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetPhysicsGroupSensorMask_s, DWORD)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetMaxSpeed_s, float *)
 
 ATTRIBUTE_METHOD (CBipedObject, ForceStop_s)
 
 ATTRIBUTE_METHOD (CBipedObject, ForceMove_s)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetIsAlwaysAboveTerrain_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetIsAlwaysAboveTerrain_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetIsAnimPaused_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetIsAnimPaused_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetBlendingFactor_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetLastWayPointType_s, int *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetLastWayPointPos_s, Vector3 *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetGravity_s, float *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetGravity_s, float)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetIgnoreSlopeCollision_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetIgnoreSlopeCollision_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetCanFly_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetCanFly_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetAlwaysFlying_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetAlwaysFlying_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetIsFlying_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, GetFlyUsingCameraDir_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetFlyUsingCameraDir_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, IsAutoWalkupBlock_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetAutoWalkupBlock_s, bool)
 
 ATTRIBUTE_METHOD1 (CBipedObject, IsControlledExternally_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBipedObject, SetIsControlledExternally_s, bool)
 
void SetMovementStyle (PhysicsMoveStyle nValue)
 how the character reacts to physics in the MoveTowards() functions
 
PhysicsMoveStyle GetMovementStyle ()
 how the character reacts to physics in the MoveTowards() functions
 
bool CanAnimOpacity () const
 
virtual Matrix4GetRenderMatrix (Matrix4 &pOut, int nRenderNumber=0)
 get the world transformation matrix for the current object. More...
 
virtual Matrix4GetAttachmentMatrix (Matrix4 &pOut, int nAttachmentID=0, int nRenderNumber=0)
 Get the specified attachment matrix of the current model. More...
 
virtual bool HasAttachmentPoint (int nAttachmentID=0)
 whether it has an attachment point More...
 
virtual bool ViewTouch ()
 this function is called, when the object is in view range. More...
 
virtual int ProcessObjectEvent (const ObjectEvent &event)
 this function is only used to backward compatibility of ParaObject:AddEvent() function. More...
 
virtual void SetPrimaryTechniqueHandle (int nHandle)
 Set a new render technique handle. More...
 
virtual void SetPosition (const DVector3 &v)
 always bottom center of the bounding shape
 
HRESULT InitObject (AssetEntity *pMAE)
 Set the base character model. More...
 
void DeleteAnimInstance ()
 delete the animation instance associated with this model.
 
virtual void Cleanup ()
 clean up the object. More...
 
CAnimInstanceBaseGetAnimInstance ()
 get the animation instance. More...
 
CParaXAnimInstanceGetParaXAnimInstance ()
 get the ParaX animation instance. More...
 
CharModelInstanceGetCharModelInstance ()
 get the character model instance. More...
 
bool DumpBVHAnimations ()
 dump BVH animations of the main character asset
 
CBaseObjectGetPhysicsBBObj ()
 get a base object containing the bounding box of the physical biped. More...
 
virtual HRESULT Draw (SceneState *sceneState)
 Desc: Render this CBipedObject instance using the current animation frames. More...
 
virtual void Animate (double dTimeDelta, int nRenderNumber=0)
 animate the model by a given delta time. More...
 
virtual AssetEntityGetPrimaryAsset ()
 used as KEY for batch rendering
 
virtual void SetNormal (const Vector3 &pNorm)
 
virtual Vector3 GetNormal ()
 
virtual void SetScaling (float s)
 set the scale of the object. More...
 
virtual float GetScaling ()
 get scaling
 
virtual void SetLocalTransform (const Matrix4 &mXForm)
 set local transform directly
 
virtual void GetLocalTransform (Matrix4 *localTransform)
 get local transform
 
virtual void GetOBB (CShapeOBB *obb)
 get the oriented bounding box in world space. More...
 
virtual void Reset ()
 reset the object to its default settings. More...
 
virtual void PathFinding (double dTimeDelta)
 environment simulator call these functions More...
 
virtual void AnimateBiped (double dTimeDelta, bool bSharpTurning=false)
 animate biped according to its current waypoint lists and speed. More...
 
virtual void SetAssetFileName (const std::string &sFilename)
 set asset file name
 
virtual int GetNumReplaceableTextures ()
 get the total number of replaceable textures, which is the largest replaceable texture ID. More...
 
virtual TextureEntityGetDefaultReplaceableTexture (int ReplaceableTextureID)
 get the default replaceable texture by its ID. More...
 
virtual TextureEntityGetReplaceableTexture (int ReplaceableTextureID)
 get the current replaceable texture by its ID. More...
 
virtual bool SetReplaceableTexture (int ReplaceableTextureID, TextureEntity *pTextureEntity)
 set the replaceable texture at the given index with a new texture. More...
 
void OneObstaclePathFinding (CBaseObject *pSolid)
 give a precise solution, in which the biped is guaranteed to be approaching the destination point. More...
 
virtual void PushParam ()
 Usually, this is used in canvas drawing. More...
 
virtual void PopParam ()
 Usually, this is used in canvas drawing. More...
 
virtual bool HasAlphaBlendedObjects ()
 return true if the object contains alpha blended render pass. More...
 
bool GetWayPoint (BipedWayPoint *pOut)
 
BipedWayPointGetLastWayPoint ()
 get the last way point. More...
 
void AddWayPoint (const BipedWayPoint &pt)
 
void RemoveWayPoint ()
 
void RemoveWayPointByType (BipedWayPoint::MyType nType=BipedWayPoint::COMMAND_POINT)
 remove all way points that matches a given type
 
virtual void SetUserControl ()
 Desc: Specifies whether this instance of CBipedObject is controlled by the user or the program. More...
 
virtual void ChooseNewLocation (Vector3 *pV)
 Desc: Determine a new location for this character to move to. More...
 
void ReplaceAIModule (CAIBase *pNew)
 replace the current AI module with a new one. More...
 
virtual CAIBaseGetAIModule ()
 Get the AI module that is dynamically associated with this object.
 
CAIBaseUseAIModule (const string &sAIType)
 use a specified AI object. More...
 
void FacingTargetImmediately ()
 facing the target immediately.
 
void FacingTarget (const Vector3 *pV)
 facing the target right away provided that the biped is not moving
 
void FacingTarget (float fTargetFacing)
 facing the target right away provided that the biped is not moving
 
virtual float GetRoll ()
 get object roll: is facing the positive x axis, if yaw is 0.
 
virtual void SetRoll (float fValue)
 
virtual float GetPitch ()
 get object pitch: is facing the positive x axis, if yaw is 0.
 
virtual void SetPitch (float fValue)
 
virtual void SetYaw (float fFacing)
 set model facing to the specified value. More...
 
virtual void UpdateGeometry ()
 update the local transform from size, roll, pitch, yaw, etc. More...
 
void SetHeadTurningAngle (float fFacing)
 set the facing of model's head. More...
 
float GetHeadTurningAngle ()
 get the head facing.It is relative to the model facing. More...
 
void SetHeadUpdownAngle (float fFacing)
 set the facing of model's head. More...
 
float GetHeadUpdownAngle ()
 get the head facing.It is relative to the model facing. More...
 
float GetHeadFacing ()
 this is the same as GetFacing()+GetHeadTurningAngle();
 
virtual void SetOpacity (float fOpacity)
 
void GetSpeedDirection (Vector3 *pV)
 get the direction vector according to speed angle of current biped. More...
 
void SetSpeedAngle (float fSpeedAngle)
 set the current speed angle. More...
 
float GetSpeedAngle ()
 get the speed direction for physics. More...
 
float GetSpeed ()
 get the magnitude of the current speed of the character. More...
 
float GetLastSpeed ()
 this is not used, unless, speed acceleration is positive. More...
 
void SetLastSpeed (float fSpeed)
 
float GetAccelerationDist ()
 when m_fSpeed is set, this acceleration is used on m_fLastSpeed, before it reach m_fSpeed. More...
 
void SetAccelerationDist (float fAccelerationDist=0.f)
 
float GetAbsoluteSpeed ()
 get the magnitude of the current speed of the character. More...
 
void SetSpeed (float fSpeed)
 set the magnitude of the current speed of the character. More...
 
float GetMaxSpeed ()
 get the maximum speed of the character. More...
 
virtual void SetSpeedScale (float dScale)
 set the animation instance's speed to dScale times of its original speed
 
virtual float GetSpeedScale ()
 
virtual void SetSizeScale (float dScale)
 set the size of the object to dScale times of its original size. More...
 
virtual float GetSizeScale ()
 
void SetBootHeight (float fBootHeight)
 set boot height, default to 0.f meters. More...
 
float GetBootHeight ()
 get boot height, default to 0.f meters. More...
 
void SetDensity (float fDensity)
 body density. More...
 
float GetDensity ()
 get body density
 
void SetGravity (float gravity)
 
float GetGravity ()
 
void SetIgnoreSlopeCollision (bool ignoreSlope)
 
bool GetIgnoreSlopeCollision ()
 
void SetCanFly (bool canFly)
 
bool GetCanFly ()
 
bool GetAlwaysFlying () const
 
void SetAlwaysFlying (bool val)
 
bool GetFlyUsingCameraDir () const
 
void SetFlyUsingCameraDir (bool val)
 
bool GetIsFlying ()
 
void SetFlyingDirection (const Vector3 *dir)
 
void SetAutoWalkupBlock (bool bAutoWalkup)
 whether automatically walk up block that is 1 block high in front of us. More...
 
bool IsAutoWalkupBlock ()
 whether automatically walk up block that is 1 block high in front of us. More...
 
bool IsControlledExternally () const
 we will not simulate or changing the character's animation, etc, since the biped is controlled externally, such as a movie actor in the script
 
void SetIsControlledExternally (bool val)
 
void FallDown ()
 if the biped is in air, it will fall down. More...
 
virtual bool IsStanding ()
 
bool IsStandingIntentioned ()
 return true, if the biped is not only standing now, but also intends to remain standing for the next frame. More...
 
void SetStandingState ()
 add the standing state action to its action manager
 
bool IsBipedBlocked ()
 If the biped is currently blocked. More...
 
void SetWalkingState (const char *sName=NULL)
 Walk using specified animation. More...
 
virtual CBipedStateManagerGetBipedStateManager (bool bCreateOnDemand=true)
 get biped state manager More...
 
virtual void SetOnAssetLoaded (const char *sCallbackScript)
 set the callback scipt whenever the primary asset is successfully loaded. More...
 
void PlayAnimation (DWORD nIndex, bool bUpdateSpeed=true, bool bAppend=false)
 Plat a specified animation by its animation index. More...
 
void PlayAnimation (const char *sName, bool bUpdateSpeed=true, bool bAppend=false)
 Plat a specified animation by its animation name. More...
 
int GetCurrentAnimation ()
 get the ID of the current animation. More...
 
virtual void SetAnimation (int nAnimID)
 Set the current animation id. More...
 
virtual int GetAnimation ()
 get the scaling. More...
 
virtual bool HasAnimation (int nAnimID)
 whether an animation id exist. More...
 
virtual void SetAnimFrame (int nFrame)
 set the current animation frame number relative to the beginning of current animation. More...
 
virtual int GetAnimFrame ()
 get the current animation frame number relative to the beginning of current animation. More...
 
virtual void EnableAnim (bool bAnimated)
 whether animation is enabled. More...
 
virtual bool IsAnimEnabled ()
 
virtual int GetTime ()
 get the current local time in case it is animated in milli seconds frames. More...
 
virtual void SetTime (int nTime)
 
virtual void SetUseGlobalTime (bool bUseGlobalTime)
 whether to use global time to sync animation. More...
 
virtual bool IsUseGlobalTime ()
 whether to use global time to sync animation. More...
 
bool MountOn (CBaseObject *pTarget, int nMountID=-1)
 mount the current character on the target More...
 
void UpdateSpeed (float fSpeed)
 update the biped's speed. More...
 
float GetVerticalSpeed ()
 get the vertical speed of the character. More...
 
void SetVerticalSpeed (float fSpeed)
 Set the vertical speed of the character. More...
 
void UseSpeedFromAnimation (int nIndex)
 use the speed defined in a specified animation by its animation index. More...
 
void UseSpeedFromAnimation (const char *sName)
 use the speed defined in a specified animation by its animation name. More...
 
bool HasAnimId (int nAnimID)
 check to see if the underlying model has a given animation id. More...
 
void PlayDeathDecayAnim ()
 TODO: may a movie track should be used.
 
void SetNextTargetPosition (const DVector3 &pV, bool bIgnoreHeight=true)
 
void WalkTo (const DVector3 &pV, bool bIgnoreHeight=true)
 force the biped to walk to a position. More...
 
void ForceMove ()
 Command the biped to move using its current facing (orientation). More...
 
void ForceStop ()
 stop the biped by removing all of its targeting way points.
 
void JumpUpward (float fVerticalSpeed, bool bJumpFromGround)
 jump up. More...
 
virtual float GetPhysicsRadius ()
 the biped is modeled as a cylinder or sphere during rough physics calculation. More...
 
void SetPhysicsRadius (float fR)
 the biped is modeled as a cylinder or sphere during rough physics calculation. More...
 
float GetPhysicsHeight ()
 the biped is modeled as a cylinder or sphere during rough physics calculation. More...
 
void SetPhysicsHeight (float fH)
 the biped is modeled as a cylinder or sphere during rough physics calculation. More...
 
float GetAssetHeight ()
 get asset height. More...
 
void ResetBipedPosition (const Vector3 *pV, bool bIgnoreHeight=true)
 
virtual void Rotate (float x, float y, float z)
 Rotate the object.This only takes effects on objects having 3D orientation, such as static mesh and physics mesh. More...
 
virtual void SetPhysicsGroupMask (DWORD dwValue)
 set groups Mask used to filter physics objects, default to 0xffffffff. More...
 
virtual DWORD GetPhysicsGroupMask ()
 get groups Mask used to filter physics objects, default to 0xffffffff. More...
 
void ResetBaseModel (AssetEntity *assetCharBaseModel)
 Reset base model. More...
 
void LoadStoredModel (int nModelSetID)
 Load a stored model in data base by the model set ID. More...
 
virtual bool IsShadowEnabled ()
 
virtual void BuildShadowVolume (SceneState *sceneState, ShadowVolume *pShadowVolume, LightParams *pLight)
 
virtual IGameObjectQueryIGameObject ()
 this may return NULL, if the object does not implement the IGameObject interface. More...
 
virtual int On_EnterSentientArea ()
 when other game objects of a different type entered the sentient area of this object. More...
 
virtual int On_LeaveSentientArea ()
 when no other game objects of different type is in the sentient area of this object. More...
 
virtual int On_Click (DWORD nMouseKey, DWORD dwParam1, DWORD dwParam2)
 when the player clicked on this object. More...
 
virtual int On_Event (DWORD nEventType, DWORD dwParam1, DWORD dwParam2)
 TODO: Some game defined events, such as user attack, etc. More...
 
virtual int On_Perception ()
 when other game objects of a different type entered the perceptive area of this object. More...
 
virtual int On_FrameMove ()
 called every frame move when this character is sentient. More...
 
virtual int On_Net_Send (DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
 during the execution of this object, it may send various network commands to the server or client. More...
 
virtual int On_Net_Receive (DWORD dwNetType, DWORD dwParam1, DWORD dwParam2)
 when the network module receives packages from the network and it is about a certain game object. More...
 
virtual bool CanHasPhysics ()
 if the object may contain physics
 
virtual void LoadPhysics ()
 load the physics objects.
 
virtual void UnloadPhysics ()
 load the physics object
 
virtual void SetPhysicsGroup (int nGroup)
 set the physics group ID to which this object belongs to default to 0, must be smaller than 32. More...
 
virtual int GetPhysicsGroup ()
 Get the physics group ID to which this object belongs to default to 0, must be smaller than 32. More...
 
virtual void EnablePhysics (bool bEnable)
 this function will turn on or off the physics of the object. More...
 
virtual bool IsPhysicsEnabled ()
 
int GetStaticActorCount ()
 get the number of physics actors. More...
 
- Public Member Functions inherited from ParaEngine::IGameObject
virtual bool ResetField (int nFieldID)
 Reset the field to its initial or default value. More...
 
virtual bool InvokeEditor (int nFieldID, const string &sParameters)
 Invoke an (external) editor for a given field. More...
 
 ATTRIBUTE_METHOD1 (IGameObject, IsModified_s, bool *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetModified_s, bool)
 
 ATTRIBUTE_METHOD (IGameObject, SaveToDB_s)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetOnLoadScript_s, const char **)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetOnLoadScript_s, const char *)
 
 ATTRIBUTE_METHOD1 (IGameObject, IsLoaded_s, bool *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetLoaded_s, bool)
 
 DEFINE_SCRIPT_EVENT (IGameObject, EnterSentientArea)
 
 DEFINE_SCRIPT_EVENT (IGameObject, LeaveSentientArea)
 
 DEFINE_SCRIPT_EVENT (IGameObject, Click)
 
 DEFINE_SCRIPT_EVENT (IGameObject, Event)
 
 DEFINE_SCRIPT_EVENT (IGameObject, Perception)
 
 DEFINE_SCRIPT_EVENT (IGameObject, FrameMove)
 
 DEFINE_SCRIPT_EVENT (IGameObject, Net_Send)
 
 DEFINE_SCRIPT_EVENT (IGameObject, Net_Receive)
 
 ATTRIBUTE_METHOD1 (IGameObject, IsGlobal_s, bool *)
 
 ATTRIBUTE_METHOD1 (IGameObject, MakeGlobal_s, bool)
 
 ATTRIBUTE_METHOD1 (IGameObject, IsSentient_s, bool *)
 
 ATTRIBUTE_METHOD1 (IGameObject, MakeSentient_s, bool)
 
 ATTRIBUTE_METHOD1 (IGameObject, IsAlwaysSentient_s, bool *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetAlwaysSentient_s, bool)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetSentientRadius_s, float *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetSentientRadius_s, float)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetPerceptiveRadius_s, float *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetPerceptiveRadius_s, float)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetGroupID_s, int *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetGroupID_s, int)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetSentientField_s, int *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetSentientField_s, int)
 
 ATTRIBUTE_METHOD1 (IGameObject, GetFrameMoveInterval_s, int *)
 
 ATTRIBUTE_METHOD1 (IGameObject, SetFrameMoveInterval_s, int)
 
virtual bool SaveToDB ()
 save the current character to database according to the persistent property. More...
 
virtual int On_Attached ()
 called when this object is attached to the scene. More...
 
virtual int On_Detached ()
 called when this object is detached from the scene
 
void LoadOnLoadScriptIfNot ()
 load the on load script if it is not loaded. More...
 
void SetOnLoadScript (const string &str)
 set the on load script. More...
 
const string & GetOnLoadScript ()
 get the on load script. More...
 
bool IsLoaded ()
 On Load script logic: the onload script is moved from the biped object to the IGameObject. More...
 
void SetLoaded (bool bLoaded)
 see IsLoaded() More...
 
virtual bool IsSentient ()
 whether the biped is sentient or not
 
virtual void MakeSentient (bool bSentient=true)
 set the object to sentient according to whether the object is currently sentient. More...
 
void ForceSentient (bool bSentient=true)
 Force the object to be sentient or not. More...
 
float GetSentientRadius ()
 get the sentient radius. More...
 
void SetSentientRadius (float fR)
 set the sentient radius. More...
 
float GetPerceptiveRadius ()
 get the perceptive radius. More...
 
void SetPerceptiveRadius (float fNewRaduis)
 Set the perceptive radius. More...
 
int GetNumOfPerceivedObject ()
 return the total number of perceived objects. More...
 
IGameObjectGetPerceivedObject (int nIndex)
 get the perceived object by index. More...
 
float GetDistanceSq2D (IGameObject *pObj)
 get the distance square between this object and another game object
 
bool IsAlwaysSentient () const
 whether the object is always sentient. More...
 
void SetAlwaysSentient (bool bAlways)
 set whether sentient. More...
 
virtual void UpdateTileContainer ()
 update the tile container according to the current position of the game object. More...
 
virtual void SetTileContainer (CTerrainTile *pTile)
 
virtual bool IsGlobal ()
 is global object
 
virtual void MakeGlobal (bool bGlobal)
 make the biped global if it is not and vice versa. More...
 
virtual void SetMovableRegion (const CShapeAABB *aabb)
 Set the region within which the object can move. More...
 
virtual const CShapeAABBGetMovableRegion ()
 get the region within which the object can move. More...
 
void SetGroupID (int nGroup)
 set the group ID to which this object belongs to. More...
 
int GetGroupID ()
 Get the group ID to which this object belongs to. More...
 
void SetSentientField (DWORD dwFieldOrGroup, bool bIsGroup=false)
 set the sentient field. More...
 
DWORD GetSentientField ()
 
bool IsSentientWith (const IGameObject *pObj)
 return true if the current object is sentient to the specified object. More...
 
virtual bool IsPersistent ()
 whether the object is persistent in the world. More...
 
virtual void SetPersistent (bool bPersistent)
 whenever a persistent object is made non-persistent, the SaveToDB() function will actually removed it from the database and the action can not be recovered. More...
 
virtual bool IsModified ()
 whether some of the fields are modified.It is up to the implementation class to provide this functionality if necessary. More...
 
virtual void SetModified (bool bModified)
 set whether any field has been modified. More...
 
int GetSimTag ()
 return the tag served for simulation. More...
 
void SetSimTag (int nTag)
 set the tag served for simulation. More...
 
std::vector< std::string > & GetPerceiveList ()
 get the names of the game objects in the object's perceptive radius. More...
 
int GetSentientObjCount ()
 the number of objects in its sentient area. More...
 
void SetSentientObjCount (int nCount)
 
void SetFrameMoveInterval (int nFrameMoveInterval)
 milliseconds interval, that the on frame move method should be called on a sentient object. More...
 
int GetFrameMoveInterval ()
 
- Public Member Functions inherited from ParaEngine::CTileObject
 ATTRIBUTE_DEFINE_CLASS (CTileObject)
 
virtual bool IsTileObject ()
 if true, we will attach this object to quad-tree terrain tile according to its attributes when adding to the scene if false, we will automatically attach it to a container object named after its class name.
 
virtual DVector3 GetPosition ()
 always bottom center of the bounding shape
 
virtual void SetBoundingBox (float fOBB_X, float fOBB_Y, float fOBB_Z, float fFacing)
 Set the object shape to box and bounding box parameters if fFacing is 0, it is a axis aligned bounding box (AABB). More...
 
virtual void GetBoundingBox (float *fOBB_X, float *fOBB_Y, float *fOBB_Z, float *fFacing)
 
virtual void SetBoundRect (float fWidth, float fHeight, float fFacing)
 Set the object shape to rect (a plane) and rect parameters if fFacing is 0, it is a axis aligned bounding box (AABB). More...
 
virtual void GetBoundRect (float *fWidth, float *fHeight, float *fFacing)
 
virtual void SetRadius (float fRadius)
 Set the object shape to Sphere and sphere parameters. More...
 
virtual float GetRadius ()
 
virtual float GetYaw ()
 get object Yaw: is facing the positive x axis, if yaw is 0.
 
virtual float GetHeight ()
 get object height y axis: only for object that has a Height property, usually is height of the bounding box
 
virtual void SetHeight (float fHeight)
 
virtual float GetWidth ()
 get object width: x axis
 
virtual void SetWidth (float fWidth)
 
virtual float GetDepth ()
 get object depth: z axis
 
virtual void SetDepth (float fDepth)
 
virtual void SetAABB (const Vector3 *vMin, const Vector3 *vMax)
 Set AABB information. More...
 
virtual Vector3 GetLocalAABBCenter ()
 
virtual void GetAABB (CShapeAABB *aabb)
 
virtual DVector3 GetObjectCenter ()
 get the center of the object in world space
 
virtual void SetObjectCenter (const DVector3 &v)
 set the center of the object in world space
 
virtual void GetVerticesWithOrigin (const Vector3 *vOrigin, Vector3 *pVertices, int *nNumber)
 
- Public Member Functions inherited from ParaEngine::CBaseObject
virtual void Clone (CBaseObject *obj)
 Clone the object's contains to a pointer. More...
 
virtual CBaseObjectClone ()
 Clone the object's contains and return a pointer to the newly created object. More...
 
int GetID ()
 the ID of the object. More...
 
virtual bool AddChildAttributeObject (IAttributeFields *pChild, int nRowIndex=-1, int nColumnIndex=0)
 add child object. More...
 
virtual void * QueryObjectByName (const std::string &sObjectType)
 convert to object of a given type. More...
 
virtual void * QueryObject (int nObjectType)
 convert to object of a given type. More...
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetID_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsGlobal_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetFacing_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetFacing_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetYaw_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetYaw_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetPitch_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetPitch_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRoll_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetRoll_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeight_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeight_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetWidth_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetWidth_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetDepth_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetDepth_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRadius_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetRadius_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetPosition_s, DVector3 *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetPosition_s, DVector3)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetAssetFileName_s, const char **)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetAssetFileName_s, const char *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetTechHandle_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetTechHandle_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetCtorPercentage_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetCtorPercentage_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHomeZone_s, const char **)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHomeZone_s, const char *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetShowBoundingBox_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetShowBoundingBox_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetPhysicsGroup_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetPhysicsGroup_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetPhysicsGroupMask_s, DWORD *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetPhysicsGroupMask_s, DWORD)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetSelectGroupIndex_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetSelectGroupIndex_s, int)
 
 ATTRIBUTE_METHOD (CBaseObject, Reset_s)
 
 DEFINE_SCRIPT_EVENT_GET (CBaseObject, OnAssetLoaded)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetOnAssetLoaded_s, const char *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRenderOrder_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetRenderOrder_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRenderImportance_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetRenderImportance_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRenderDistance_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetRenderDistance_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetAnimation_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetAnimation_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetAnimFrame_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetAnimFrame_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsAnimEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, EnableAnim_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsUseGlobalTime_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetUseGlobalTime_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetChildCount_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetNormal_s, Vector3 *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetNormal_s, Vector3)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsTransparent_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetTransparent_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsVisible_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetVisibility_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsShadowCaster_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetShadowCaster_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsShadowReceiver_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetShadowReceiver_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsBillboarded_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetBillboarded_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsSkipRender_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetSkipRender_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsSkipPicking_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetSkipPicking_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsSkipTerrainNormal_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetSkipTerrainNormal_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetSelectionEffect_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetSelectionEffect_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsHeadOnZEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnZEnabled_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsHeadOn3DScalingEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOn3DScalingEnabled_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsHeadOnUseGlobal3DScaling_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnUseGlobal3DScaling_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOnNearZoomDist_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnNearZoomDist_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOnFarZoomDist_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnFarZoomDist_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOnMinUIScaling_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnMinUIScaling_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOnMaxUIScaling_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnMaxUIScaling_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOnAlphaFadePercentage_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOnAlphaFadePercentage_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetHeadOn3DFacing_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetHeadOn3DFacing_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsPersistent_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetPersistent_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsDead_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetDead_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsTileObject_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetTileObject_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetFrameNumber_s, int *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetFrameNumber_s, int)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetOpacity_s, float *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetOpacity_s, float)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsLastFrameRendered_s, bool *)
 
 ATTRIBUTE_METHOD (CBaseObject, DestroyChildren_s)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetRenderMatrix_s, Matrix4 *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, SetLocalTransform_s, const Matrix4 &)
 
 ATTRIBUTE_METHOD1 (CBaseObject, GetLocalTransform_s, Matrix4 *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsPhysicsEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, EnablePhysics_s, bool)
 
 ATTRIBUTE_METHOD1 (CBaseObject, IsLODEnabled_s, bool *)
 
 ATTRIBUTE_METHOD1 (CBaseObject, EnableLOD_s, bool)
 
bool IsBiped ()
 
virtual IAttributeFieldsGetAttributeObject ()
 
bool CheckVolumnField (DWORD volType)
 Use CheckAttribute()
 
virtual TextureEntityGetTexture ()
 
bool CheckAttribute (DWORD attribute)
 whether an object attribute is enabled. More...
 
void SetAttribute (DWORD dwAtt, bool bTurnOn=true)
 enable or disable a given attribute. More...
 
void SetBillboarded (bool bBillboarded)
 
bool IsBillboarded ()
 if the model asset file name ended with "_b" it will be treated as billboarded. More...
 
void SetShadowReceiver (bool bEnable)
 
bool IsShadowReceiver ()
 if the model asset file name ended with "_r" it will be treated as shadow receiver. More...
 
void SetShadowCaster (bool bEnable)
 set whether it is shadow caster. More...
 
bool IsShadowCaster ()
 
void SetVegetation (bool bIsVegetation)
 whether to render this mesh using the vegetation shader
 
bool IsVegetation ()
 whether to render this mesh using the vegetation shader
 
void ShowBoundingBox (bool bShowBoundingBox)
 set whether to show bounding box for this object.
 
bool IsShowBoundingBox ()
 get whether to show bounding box for this object.
 
CZoneNodeGetHomeZone ()
 get the home zone of this object if any. More...
 
void SetHomeZone (CZoneNode *pZone)
 set the home zone of this object if any. More...
 
bool IsVisible ()
 invisible object will not be drawn. More...
 
void SetVisibility (bool bVisible)
 set the visibility of this object. More...
 
bool IsRenderable ()
 whether this object can be rendered. More...
 
void SetSkipRender (bool bSkipRender)
 set whether object should be excluded from the skip render
 
bool IsSkipRender ()
 get whether object should be excluded from the render queue. More...
 
void SetSkipPicking (bool bSkipPicking)
 set whether object should be excluded from picking
 
bool IsSkipPicking ()
 get whether object should be excluded from picking. More...
 
void SetSkipTerrainNormal (bool bSkip)
 if specified, this character will always be perpendicular to the ground, regardless to the terrain normal. More...
 
bool IsSkipTerrainNormal ()
 if specified, this character will always be perpendicular to the ground, regardless to the terrain normal. More...
 
bool CanPick ()
 get whether object can be picked by mouse picking. More...
 
virtual void SetAlwaysLoadPhysics (bool bEnable)
 by default physics is lazy-load when player walk into its bounding box, setting this to false will always load the physics. More...
 
void SetRenderImportance (int nRenderImportance)
 the larger, the more important. More...
 
int GetRenderImportance ()
 
float GetRenderOrder () const
 0 if automatic, larger number renders after smaller numbered object. More...
 
void SetRenderOrder (float val)
 
CChildObjectList_TypeGetChildren ()
 – Base object functions
 
CBaseObjectGetChildByName (const string &name, bool bRecursive=false)
 get child by name: it may return NULL if the child does not exist. More...
 
virtual void DestroyChildren ()
 Completely destroy child nodes from memory recursively. More...
 
int DestroyChildByName (const string &name, bool bRecursive=false)
 destroy a child by name. More...
 
int RemoveChildByName (const string &name, bool bRecursive=false)
 remove a child by name but it does not destroy it. More...
 
int RemoveChild (const CBaseObject *pObj, bool bRecursive=false)
 remove a child by pointer but it does not destroy it. More...
 
bool ActivateScript (int func_type, const string &precode, const string &postcode)
 Fire script callback global variable sensor_name and sensor_id will be filled with GetName and GetID, so that caller knows who is firing the callback script. More...
 
bool ActivateScript (int func_type, const string &precode)
 
bool ActivateScript (int func_type)
 
virtual int GetSelectionEffect ()
 get the render effect when character is in selected state. More...
 
virtual void SetSelectionEffect (int nStyle)
 get the render effect when character is in selected state. More...
 
virtual float GetOpacity ()
 
virtual HRESULT InitDeviceObjects ()
 
virtual HRESULT RestoreDeviceObjects ()
 
virtual HRESULT InvalidateDeviceObjects ()
 
virtual HRESULT DeleteDeviceObjects ()
 
virtual HRESULT RendererRecreated ()
 
virtual float GetRenderDistance ()
 we will not render this object if the object's position to camera eye position is further than this value. More...
 
virtual void SetRenderDistance (float fDist)
 
virtual int GetPrimaryTechniqueHandle ()
 when batch-rendering a group of objects, objects are usually sorted by their render techniques and then by their primary asset. More...
 
virtual CParameterBlockGetEffectParamBlock (bool bCreateIfNotExist=false)
 get effect parameter block with this object. More...
 
virtual bool IsTransparent ()
 whether the object contains transparent material. More...
 
virtual void SetTransparent (bool bIsTransparent)
 Set whether the object is transparent. More...
 
virtual void OnSelect (int nGroupID)
 called when an object is selected. More...
 
virtual void OnDeSelect ()
 called whenever an object is un-selected. More...
 
virtual void AddChild (CBaseObject *pObject)
 add another object as the child of this object
 
virtual void SetParent (CBaseObject *pParent)
 this function is called by parent class to set the child's parent. More...
 
virtual CBaseObjectGetParent ()
 
virtual bool IsDead ()
 whether this object should be removed some time in the future. More...
 
virtual void SetDead ()
 
virtual void AddToDeadObjectPool ()
 When a child object wants to remove itself, it is usually not safe to do so immediately, instead the object add itself to dead object pool for the root scene to safely remove it at the end of the frame. More...
 
virtual int PrepareRender (CBaseCamera *pCamera, SceneState *sceneState)
 derived class can override this function to place the object in to the render pipeline. More...
 
virtual Vector3GetAttachmentPosition (Vector3 &pOut, int nAttachmentID=0, int nRenderNumber=0)
 whether it has an attachment point More...
 
virtual const std::string & GetAssetFileName ()
 get asset file name
 
virtual float GetCtorPercentage ()
 Get the object construction percentage (progress) in the range[0,1]. More...
 
virtual void SetCtorPercentage (float fPercentage)
 Set the object construction percentage (progress) in the range[0,1]. More...
 
virtual void AutoSelectTechnique ()
 automatically select the proper technique for the rendering of the object. More...
 
virtual void Report (vector< string > &v_sReport)
 
virtual HRESULT ResetTime ()
 
virtual void CompressObject (CompressOption option=(CompressOption) 0xffff)
 Compress the object to save memory. More...
 
virtual IViewClippingObjectGetViewClippingObject ()
 return the view clipping object used for object-level clipping when rendering this object.
 
virtual void UpdateFrameNumber (int nFrameNumber)
 this function is called to update the render frame number of this object. More...
 
void SetFrameNumber (int nFrameNumber)
 
int GetFrameNumber ()
 get the frame number that this object is last accessed. More...
 
bool CheckFrameNumber (int nFrameNumber)
 call this function whenever a render may render this object. More...
 
bool IsLastFrameRendered ()
 check to see if the last frame is rendered. More...
 
void SetMyType (ObjectType t)
 set the type of the object, it tells what this object is used for. More...
 
ObjectType GetMyType ()
 
void SnapToTerrainSurface (bool bUseNorm=true)
 call this function to reset the y component and norm of the object to the global terrain surface at (x,0,z), where (x,y,z) is the object's current position. More...
 
virtual ObjectShape GetObjectShape ()
 get the object shape
 
virtual void SetObjectShape (ObjectShape shape)
 set the object shape
 
CTerrainTileGetTileContainer ()
 get the quad-tree terrain tile that this game object is currently visiting. More...
 
void SetHomeZoneName (const char *sName)
 set the home zone name. More...
 
const char * GetHomeZoneName ()
 
void SetSelectGroupIndex (int nGroupIndex=-1)
 set the selection group index. More...
 
int GetSelectGroupIndex ()
 get the selection group index. More...
 
virtual void SetTileObject (bool bIsTileObject)
 
bool IsGeometryDirty () const
 whether the shape of the object is dirty, such as model, size, facing, local transform is changed. More...
 
void SetGeometryDirty (bool bDirty=true)
 
bool IsLODEnabled () const
 whether to enable lod if there is lod. More...
 
void EnableLOD (bool val)
 
virtual int GetMeshTriangleList (std::vector< Vector3 > &output, int nOption=0)
 return triangle list
 
- Public Member Functions inherited from ParaEngine::IViewClippingObject
virtual void GetVertices (Vector3 *pVertices, int *nNumber)
 get all the vertices which can represent the object's shape. More...
 
virtual void GetRenderVertices (Vector3 *pVertices, int *nNumber)
 same as GetVertices(). More...
 
virtual void SetRotation (const Quaternion &quat)
 set rotation using a quaternion. More...
 
virtual void GetRotation (Quaternion *quat)
 get rotation using a quaternion
 
virtual Vector3 GetRenderOffset ()
 get the offset(translation) of the object used for rendering. More...
 
virtual void GetFacing3D (Vector3 *pV)
 get object facing: only for object that has a facing property like biped, not bound facing
 
float GetFacing ()
 same as GetYaw and SetYaw get object facing: only for object that has a facing property like biped, not bound facing The object is facing the positive x axis, if facing is 0.
 
void SetFacing (float fFacing)
 
virtual void SetTransform (Matrix4 *pLocalTransform, const DVector3 &pGlobalPos, float *pRotation)
 Set a local transform matrix, a global position and a facing value, according to which the object will be transformed on demand, so that the transformed object can be used for efficient object-level view culling in ParaEngine. More...
 
virtual void SetTransform (Matrix4 *pWorldTransform)
 
virtual Matrix4GetWorldTransform (Matrix4 &pOut, int nRenderNumber=0)
 get world transform
 
virtual bool TestCollisionSphere (const Vector3 *pvCenter, float radius, BYTE nMethod=1)
 – collision detection More...
 
virtual bool TestCollisionSphere (CBaseCamera *pCamera, float fFarPlaneDistance)
 assume that the object is a sphere, it will return false if the sphere is completely out of the 6 frustum planes of the camera More...
 
virtual bool TestShadowSweptSphere (CBaseCamera *pCamera, const Vector3 *pvDirection)
 assume that the object is a sphere, it will return false if the swept sphere along the given direction is completely out of the 6 frustum planes of the camera this function is usually used to test whether we need to render this object as shadow caster, where pvDirection is the current sun direction.
 
virtual bool TestCollision (CBaseCamera *pCamera)
 check if the object's original shape can be seen via a camera. More...
 
virtual bool TestCollisionObject (IViewClippingObject *pObj)
 desc: test if the object collide with this object in the world view. More...
 
virtual bool TestCollisionRay (const Vector3 &vPickRayOrig, const Vector3 &vPickRayDir, float *fDistance)
 Desc: Check the ray intersection with the object input:vPickRayOrig,vPickRayDir: mouse ray params output: fDistance: the distance between the eye and the intersection point. More...
 
virtual float GetSphereCollisionDepth (Vector3 *pvCenter, float radius, bool bSolveDepth=false)
 desc: this is similar to TestCollisionSphere, but does more than that. More...
 
virtual float GetObjectCollisionDepth (IViewClippingObject *pObj)
 desc: test if the circle in the y=0 plane collide with this object in the world view Note: radius can be zero. More...
 
virtual float GetObjectToPointDistance (const Vector3 *pPoint)
 get the distance from the object's surface to a given point. More...
 
virtual void DrawBoundingBox (SceneState *sceneState, DWORD color)
 debugging only: draw bounding box
 
virtual void DrawOcclusionObject (SceneState *sceneState)
 draw the occlusion object More...
 
virtual void DebugDraw (IBatchedElementDraw *pDebugDraw)
 this function is called whenever debugging drawing is enabled. More...
 
- Public Member Functions inherited from ParaEngine::IRefObject
virtual const std::string & GetIdentifier ()
 get the name or identifier. More...
 
virtual void SetIdentifier (const std::string &sID)
 
int GetNameW (std::u16string &out)
 gets the unicode name
 
const std::string & GetName ()
 alias name for GetIdentifier
 
IRefObjectGetRefObjectByName (const char *sName)
 
RefListItemGetRefObjectByTag (int nTag)
 get the first reference object by its tag
 
bool HasReferences ()
 
RefResult AddReference (IRefObject *maker, int nTag=0)
 add a new reference. More...
 
RefResult DeleteReference (IRefObject *ref)
 delete a reference. More...
 
RefResult DeleteAllRefs ()
 Deletes all references of this object. More...
 
int DeleteAllRefsByTag (int nTag=0)
 Deletes all references whose tag is nTag of this object. More...
 
RefListGetRefList ()
 get the ref list
 
int GetRefObjNum ()
 get the total number of references
 
RefListItemGetRefObject (int nIndex)
 get the referenced object at the given index. More...
 
virtual void OnRefAdded (IRefObject *rm, int nTag=0)
 This is called after another object added this object to its reference list. More...
 
virtual void OnRefDeleted (IRefObject *rm)
 This is called after another object deleted this object from its reference list. More...
 
- Public Member Functions inherited from ParaEngine::IAttributeFields
 ATTRIBUTE_METHOD1 (IAttributeFields, GetName_s, const char **)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetName_s, const char *)
 
 ATTRIBUTE_METHOD (IAttributeFields, PrintObject_s)
 
 ATTRIBUTE_METHOD (IAttributeFields, AddRef_s)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetRefCount_s, int *)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, SetTime_s, int)
 
 ATTRIBUTE_METHOD1 (IAttributeFields, GetTime_s, int *)
 
 ATTRIBUTE_METHOD (IAttributeFields, Release_s)
 
virtual bool ValidateFields ()
 validate all fields and return true if validation passed. More...
 
virtual string GetValidationMessage ()
 get the recent validation message due to the most recent call to ValidateFields()
 
virtual bool InvokeEditor (int nFieldID, const std::string &sParameters)
 Invoke an (external) editor for a given field. More...
 
virtual CDynamicAttributeFieldGetDynamicField (const std::string &sName)
 Get a dynamic field with a given name. More...
 
virtual CDynamicAttributeFieldGetDynamicField (int nIndex)
 Get a dynamic field with a given index. More...
 
virtual const char * GetDynamicFieldNameByIndex (int nIndex)
 get field name by index
 
virtual int GetDynamicFieldCount ()
 how many dynamic field this object currently have. More...
 
virtual int SetDynamicField (const std::string &sName, const CVariable &value)
 set a dynamic field with a given name. More...
 
virtual int AddDynamicField (const std::string &sName, ATTRIBUTE_FIELDTYPE dwType)
 add dynamic field and return field index
 
virtual void RemoveAllDynamicFields ()
 remove all dynamic fields
 
virtual int SaveDynamicFieldsToString (std::string &output)
 save only text dynamic fields to fieldname = value text strings. More...
 
virtual int LoadDynamicFieldsFromString (const std::string &input)
 load only text dynamic fields from string More...
 
CAttributeClassGetAttributeClass ()
 get the main attribute class object. More...
 
void PrintObject ()
 print the content of this object to a text file at temp/doc/[ClassName].txt. More...
 
- Public Member Functions inherited from ParaEngine::IObject
virtual void Clone (IObject *obj) const
 Clone the object's contains to a pointer. More...
 
virtual IObjectClone () const
 Clone the object's contains and return a pointer to the newly created object. More...
 
virtual bool Equals (const IObject *obj) const
 Compare the object with another object. More...
 
virtual const ITypeGetType () const
 
virtual std::string ToString () const
 
WeakPtr_typeGetWeakReference ()
 get weak reference object. More...
 
- Public Member Functions inherited from ParaEngine::CRefCounted
void addref () const
 add reference count of the object. More...
 
bool delref () const
 decrease reference count of the object. More...
 
int GetRefCount () const
 get the reference count
 
virtual int Release ()
 
CRefCountedAddToAutoReleasePool ()
 addref and releases the ownership sometime soon automatically (usually at the end of the current frame). More...
 
- Public Member Functions inherited from ParaEngine::IHeadOn3D
void SetHeadOnText (const char *sText, int nIndex=0)
 set the text to be displayed on head on display
 
const char * GetHeadOnText (int nIndex=0)
 Get the text to be displayed on head on display.
 
void SetHeadOnUITemplateName (const char *sUIName, int nIndex=0)
 set which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used. More...
 
const char * GetHeadOnUITemplateName (int nIndex=0)
 get which UI control the head on display will be used as a template for drawing the text it can be a single CGUIText Object or it can be a container with a direct children called "text" if this is "" or empty, the default UI template will be used. More...
 
const std::string & GetHeadOnUITemplateNameS (int nIndex=0)
 
virtual CGUIBaseGetHeadOnUIObject (int nIndex=0)
 
void SetHeadOnTextColor (DWORD color, int nIndex=0)
 set the text to be displayed on head on display
 
DWORD GetHeadOnTextColor (int nIndex=0)
 Get the text to be displayed on head on display.
 
void SetHeadOnOffest (const Vector3 &vOffset, int nIndex=0)
 set the offset where head on display should be rendered relative to the origin or head of the host 3d object
 
void GetHeadOnOffset (Vector3 *pOut, int nIndex=0)
 Get the offset where head on display should be rendered relative to the origin or head of the host 3d object.
 
void ShowHeadOnDisplay (bool bShow, int nIndex=0)
 show or hide object's head on display
 
bool IsHeadOnDisplayShown (int nIndex=0)
 whether the object head on display shall be visible
 
bool IsHeadOnZEnabled (int nIndex=0)
 whether z buffer test is enabled for Head On display. More...
 
void SetHeadOnZEnabled (bool bZnabled, int nIndex=0)
 set if z buffer test is enabled for Head On display. More...
 
virtual bool HasHeadOnDisplay (int nIndex=0)
 whether the object contains head on display at given index
 
bool IsHeadOn3DScalingEnabled (int nIndex=0)
 Enable 3d scaling. More...
 
void SetHeadOn3DScalingEnabled (bool bZnabled, int nIndex=0)
 Enable 3d scaling.
 
bool IsHeadOnUseGlobal3DScaling (int nIndex=0)
 this is only used when m_bEnable3DScaling. More...
 
void SetHeadOnUseGlobal3DScaling (bool bZnabled, int nIndex=0)
 this is only used when m_bEnable3DScaling. More...
 
void SetHeadOnNearZoomDist (float fValue, int nIndex=0)
 
float GetHeadOnNearZoomDist (int nIndex=0)
 
void SetHeadOnFarZoomDist (float fValue, int nIndex=0)
 
float GetHeadOnFarZoomDist (int nIndex=0)
 
void SetHeadOnMinUIScaling (float fValue, int nIndex=0)
 
float GetHeadOnMinUIScaling (int nIndex=0)
 
void SetHeadOnMaxUIScaling (float fValue, int nIndex=0)
 
float GetHeadOnMaxUIScaling (int nIndex=0)
 
void SetHeadOnAlphaFadePercentage (float fValue, int nIndex=0)
 
float GetHeadOnAlphaFadePercentage (int nIndex=0)
 
void SetHeadOn3DFacing (float fValue, int nIndex=0)
 turn on 3d facing when this function is called
 
float GetHeadOn3DFacing (int nIndex=0)
 
- Public Member Functions inherited from ParaEngine::IObjectScriptingInterface
virtual bool AddScriptCallback (int func_type, const string &script_func)
 add a new call back handler. More...
 
virtual ScriptCallbackGetScriptCallback (int func_type)
 return NULL if there is no associated script. More...
 
virtual bool RemoveScriptCallback (int func_type)
 remove a call back handler
 

Static Public Attributes

static const float SPEED_TURN = 2.7f
 
static const float SPEED_WALK = 0.9f
 
static const float SPEED_NORM_TURN = 0.7f
 

Protected Member Functions

bool MoveTowards (double dTimeDelta, const DVector3 &vPosTarget, float fStopDistance, bool *pIsSlidingWall=NULL)
 Move the biped in the physical scene.move the biped towards the target using its current speed and facing the biped may slide along a wall or be stopped. More...
 
bool MoveTowards_OPC (double dTimeDelta, const DVector3 &vPosTarget, float fQuickMoveDistance=15.f)
 move as an OPC. More...
 
bool MoveTowards_Linear (double dTimeDelta, const DVector3 &vPosTarget)
 move as an OPC. More...
 
bool CheckBlockWorld (DVector3 &vMovePos, Vector3 &vMinPos, Vector3 &vMaxPos, bool &bUseGlobalTerrainNorm, bool &bReachPos, Vector3 &vBipedFacing, float fDeltaTime)
 vMovePos is new tentative position that the player is moving towards. More...
 
bool FacingTowards (double dTimeDelta, float fTargetFacing)
 fFacingTarget: it must be in the range [0, 2*pi]
 
void UpdateState (float fTimeDelta)
 this function is only called by the AnimateBiped() to update states for active bipeds. More...
 
bool SetParamsFromAsset ()
 set params from asset when the asset is available (async asset loading) More...
 
void SetIsAlwaysAboveTerrain (bool bEnable)
 set whether character should always above terrain during movement. More...
 
bool GetIsAlwaysAboveTerrain ()
 get whether character should always above terrain during movement. More...
 
void SetIsAnimPaused (bool bPaused)
 true to pause animation. More...
 
bool GetIsAnimPaused ()
 true to pause animation. More...
 
void SetBlendingFactor (float fBlendingFactor)
 set the blending factor between the current and blend animation. More...
 
bool FlyTowards (double dTimeDelta, const DVector3 &vPosTarget, float fStopDistance, bool *pIsSlidingWall)
 
void AnimateIdle (double dTimeDelta)
 Desc: Checks if Tiny has been idle for long enough. More...
 
void AnimateMoving (double dTimeDelta, bool bSharpTurning=false)
 Desc: Here we try to figure out if we're moving and can keep moving, or if we're waiting / blocked and must keep waiting / blocked, or if we have reached our destination. More...
 
void AnimateUserControl (double dTimeDelta)
 Desc: Reads user input and update Tiny's state and animation accordingly.
 
ParaXEntityGetParaXEntity ()
 get parax asset entity if its type is ParaX model. More...
 
- Protected Member Functions inherited from ParaEngine::IAttributeFields
virtual CAttributeClassCreateAttributeClass ()
 initialize fields
 
virtual CDynamicAttributesSetGetDynamicAttributes (bool bCreateIfNotExist=false)
 

Additional Inherited Members

- Static Public Member Functions inherited from ParaEngine::CBaseObject
static CBaseObjectGetObjectByID (int nID)
 GetObject By ID. More...
 
- Static Public Member Functions inherited from ParaEngine::IAttributeFields
static HRESULT GetAttributeClassID_s (IAttributeFields *cls, int *p1)
 
static HRESULT GetAttributeClassName_s (IAttributeFields *cls, const char **p1)
 
static bool OpenWithDefaultEditor (const char *sFilename, bool bWaitOnReturn=false)
 Open a given file with the default registered editor in the game engine. More...
 
- Static Public Member Functions inherited from ParaEngine::IHeadOn3D
static bool DrawHeadOnUI (CBaseObject *pObj, int &nCounter, SceneState *pSceneState=NULL, CGUIText **ppObjUITextDefault=NULL, bool bZEnablePass=true, bool b3DTextPass=false)
 draw the headon UI of a specified object. More...
 
static bool BeginPaint (SceneState *pSceneState, bool b3DTextPass, bool bZEnablePass)
 HeadOn UI needs to be drawn between BeginPaint and EndPaint, which is usually automatically when the first and last head on UI is called. More...
 
static void EndPaint (SceneState *pSceneState, bool b3DTextPass)
 
- Protected Attributes inherited from ParaEngine::IGameObject
int m_nSimTag
 
- Protected Attributes inherited from ParaEngine::CTileObject
DVector3 m_vPos
 position is always at the bottom center of the bounding shape. More...
 
CShapeAABB m_aabb
 bounding box of containing object. More...
 
float m_fYaw
 yaw or facing
 
float m_fRadius
 radius of m_aabb
 
- Protected Attributes inherited from ParaEngine::CBaseObject
int m_nID
 the ID of the object. More...
 
DWORD m_dwAttribute
 volume type and attribute of this object. More...
 
CChildObjectList_Type m_children
 child objects array: we keep strong references (ref counted) to child objects
 
ObjectType m_objType
 type of the object
 
CTerrainTilem_tileContainer
 
int32 m_nTechniqueHandle
 the primary technique handle
 
int32 m_nFrameNumber
 the frame number that this object is last accessed. More...
 
int32 m_nSelectGroupIndex
 this is the selection group index. More...
 
int32 m_nRenderImportance
 the larger, the more important. More...
 
float m_fRenderOrder
 0 if automatic, larger number renders after smaller numbered object. More...
 
float m_fRenderDistance
 we will not render this object if the object's position to camera eye position is further than this value. More...
 
CParameterBlockm_pEffectParamBlock
 effect param block that should be applied to m_nTechniqueHandle
 
bool m_bGeometryDirty: 1
 whether the shape of the object is dirty, such as model, size, facing, local transform is changed. More...
 
bool m_bEnableLOD: 1
 whether to enable lod if there is lod. More...
 
- Protected Attributes inherited from ParaEngine::IRefObject
RefList m_references
 This is the list of active references that refer to us.
 
std::string m_sIdentifer
 unit name used in the scripting language
 
- Protected Attributes inherited from ParaEngine::IObject
WeakPtr_type m_weak_reference
 
- Protected Attributes inherited from ParaEngine::CRefCounted
int m_refcount
 
- Protected Attributes inherited from ParaEngine::IObjectScriptingInterface
ObjectCallbackPool_Type m_callback_scripts
 the NPL script handlers
 
- Static Protected Attributes inherited from ParaEngine::CBaseObject
static int g_nObjectSelectionEffect = ParaEngine::RenderSelectionStyle_border
 enum of RenderSelectionStyle More...
 

Detailed Description

It can be used to represent biped object(like human, re spawning monsters) in the scene without inheriting and adding new functions.

This class and its inherited classes does some basic things to make the element(or character) aware of its surroundings, as well as implements all actions and movements.

CBipedObject provides many virtual functions that may be called many times by other modules(such as Environment Simulator and AI Simulator ), so that inherited class that override the parent implementation easily.

the biped can be associated with either MultiAnimationEntity or MDXEntity which will used to render the 3D animations.One of the AnimationInstanceBase derived class should be used to control the animation of the biped object as well as the speed of the biped. AI controllers can also be associated with biped object, in which case the biped would act on their own. The behavior of the biped is controlled through Events like all Base objects. High Level Event can be assigned to biped object to control almost everything about a biped object at run time, such as playing new animation, walking to a new position or even assigning AI tasks.

Note 1: It is not suggested to have too many inherited class of this class in depth, because it will induce too many data space waste. As you may see, I have used as few data words as possible in this set of classes. Note 2: For mdx file animation entity. The Associated animation instance must contain animations "Stand" and "Walk"(if it ever moves).Some other animation name can be "Death", "Decay" These animation names are recognizable by the engine, and will be played when the user does not specifying them explicitly. For more information please see member functions. Note 3: For x file animation entity: Biped has a set of predefined actions, but any single x file may not contain all of them. So there is a tree like degradation structure. That is actions are reorganized in a tree, with each action assigned to a tree node. Upon initializing those actions, we will start from the top of the tree. If a node(action) does not find it's exact action in the x file, then its parent's action index is used. The process is recursive. So that all actions will be assigned an action index in the index file. The worst case will be all nodes has index the same as the root node which is the loiter(idle) action. The following is the predefined action. Stand–>Walk–>jog –>swim –>jump–>jump forward/backward –>sidestep right/left –>Speak–>say good bye –>say hello –>action0–>action1–>action2~action5 –>action6–>action7~action10 There is a constraint: if the parent is default, then all its descendants are set to default regardless there is an exact animation in the file or not.

Member Enumeration Documentation

§ PhysicsMoveStyle

how the character reacts to physics in the MoveTowards() functions

Enumerator
MOVESTYLE_SLIDINGWALL 

character will slide along the wall infinitely.

This is computationally most expensive.

MOVESTYLE_HEIGHTONLY 

only care about the terrain(and model) height before its feet

MOVESTYLE_ABOVETERRAIN 

no physics are applied, and make the character above terrain.

It can stay higher than the terrain.

MOVESTYLE_LINEAR 

just linear interpolate from current pos to target pos, without using any physics.

MOVESTYLE_OPC 

OPC is the default for remote player agent.

the behavior is simple. if it is too far away from destination, move linearly but with physics height. when it is close to destination, only move according to MOVESTYLE_HEIGHTONLY More over, if biped is away from the camera far plane, we will move the biped to the destination immediately.

§ RenderSelectionStyle

how to render a selected object

Enumerator
RenderSelectionStyle_unlit 

just appear brighter without applying light effect and diffuse color is 1.

RenderSelectionStyle_border 

a yellow border around the biped.

RenderSelectionStyle_flash 

flashing the biped. Not implemented.

Member Function Documentation

§ Animate()

void CBipedObject::Animate ( double  dTimeDelta,
int  nRenderNumber = 0 
)
virtual

animate the model by a given delta time.

Parameters
dTimeDeltadelta time in seconds
nRenderNumberif 0 it means that it is always animated, otherwise we should only animate if previous call of this function has a different render frame number than this one.

For animation instance.

get world position from the mount point

Set world position from the mount point

Reimplemented from ParaEngine::CBaseObject.

§ AnimateBiped()

void CBipedObject::AnimateBiped ( double  dTimeDelta,
bool  bSharpTurning = false 
)
virtual

animate biped according to its current waypoint lists and speed.

assuming that no obstacles are in the way it moves.

Reimplemented from ParaEngine::IGameObject.

§ AnimateIdle()

void CBipedObject::AnimateIdle ( double  dTimeDelta)
protected

Desc: Checks if Tiny has been idle for long enough.

If so, initialize Tiny to move again to a new location.

§ AnimateMoving()

void CBipedObject::AnimateMoving ( double  dTimeDelta,
bool  bSharpTurning = false 
)
protected

Desc: Here we try to figure out if we're moving and can keep moving, or if we're waiting / blocked and must keep waiting / blocked, or if we have reached our destination.

bSharpTurning: when set this to true, the biped is first turned towards the destination and then moves towards it, otherwise, the biped will move while turning.

Set world position from the mount point

when it is a pathingfinding-point, we will implement simple movement in which biped is first turned and then moved.

only facing the target when in blocked mode action: the biped should be set to standing state

§ CheckBlockWorld()

bool ParaEngine::CBipedObject::CheckBlockWorld ( DVector3 vMovePos,
Vector3 vMinPos,
Vector3 vMaxPos,
bool &  bUseGlobalTerrainNorm,
bool &  bReachPos,
Vector3 vBipedFacing,
float  fDeltaTime 
)
protected

vMovePos is new tentative position that the player is moving towards.

Parameters
vMovePos[in/out]:
vMinPos[in/out]:
vMaxPos[in/out]:
Returns
: bUseMinMaxBox: if true, the position should be confined in vMinPos and vMaxPos.

head block index. if biped is 2-block high or 1 block high

§ ChooseNewLocation()

void CBipedObject::ChooseNewLocation ( Vector3 pV)
virtual

Desc: Determine a new location for this character to move to.

In this case we simply randomly pick a spot on the floor as the new location.

§ Cleanup()

void CBipedObject::Cleanup ( )
virtual

clean up the object.

So that the object is ready to be deleted

Reimplemented from ParaEngine::CBaseObject.

§ Draw()

HRESULT CBipedObject::Draw ( SceneState sceneState)
virtual

Desc: Render this CBipedObject instance using the current animation frames.

This function guarantees that the animation is rendered. animation instance is forced to be created if it's not available. So never call this function if the object is not in the view frustum. Otherwise, memory is wasted. vNorm is calculated by the following rule: (1) if vNorm.y ==0 (uninitialized), then calculate from terrain surface (2) if vNorm is valid and object is moving, use smooth transform (3) if vNorm is valid and object is static or stopped, use the old norm.

Reimplemented from ParaEngine::CBaseObject.

§ EnableAnim()

void ParaEngine::CBipedObject::EnableAnim ( bool  bAnimated)
virtual

whether animation is enabled.

by default this is true. During movie editing, we may disable animation, set animation frame explicitly by editor logics.

Reimplemented from ParaEngine::CBaseObject.

§ EnablePhysics()

void ParaEngine::CBipedObject::EnablePhysics ( bool  bEnable)
virtual

this function will turn on or off the physics of the object.

Reimplemented from ParaEngine::CBaseObject.

§ FallDown()

void CBipedObject::FallDown ( )

if the biped is in air, it will fall down.

In case a biped is put to stop and the terrain below it changes. one should manually call this function to let the biped fall down. Internally it just set the vertical speed to a small value

§ FlyTowards()

bool CBipedObject::FlyTowards ( double  dTimeDelta,
const DVector3 vPosTarget,
float  fStopDistance,
bool *  pIsSlidingWall 
)
protected

check to see if the maximum penetration distance allowed. In each simulation step, if the biped moves longer than this step, it is further divided in to several evenly spaced steps. the step length is determined by the biped's speed multiplied by the time delta. See also NX_MIN_SEPARATION_FOR_PENALTY, and CBipedObject::MoveTowards()

ignore PENETRATION_DISTANCE, if it takes longer than MAX_STEPS_PER_FRAME per frame.

check whether the biped is under water. if so set water state. the acceleration of biped under water is Gw= (1-e/D)*G -(V*V)*k where G is gravity of the earth, D is the density of the object, V is the vertical speed of the biped. e is the percentage of object body under water. It is 1 when object is completely underwater, and (0,1) when partially underwater, and 0 when not underwater. k denotes water resistance, which is 0.1f.

the larger the more resistance between [0,1].

when an object is crossing the water/air surface with a speed less than WATER_SKIP_VELOCITY m/s, we will not allow the object to escape to air or water, but rather floating at the height of m_fDensity*fHeight;

the fall down speed should be small.

when an object is crossing the water/air surface with a speed less than WATER_SKIP_VELOCITY m/s, we will not allow the object to escape to air or water, but rather floating at the height of m_fDensity*fHeight;

true to ignore global terrain physics. The object will fall through the global terrain. This is automatically set by the MoveTowards() method. If the height of the object is well below of the global terrain surface, it is assumed to be underground, such as in the cave or tunnel. The camera will also ignore collision with the terrain objects.

if we're within reach, we will stop without reaching the exact target point

  • Cast a group of n (n=3) rays (group 0) in front of the character, which covers a region of (n-2)/(n-1)*Pi radian. if several sensor rays hit some obstacles within the radius of the object, we will see if the world impact normals are roughly the same. If so, the character is considered to be blocked by a single wall..In case of a single blocking wall,we will try slide the character along the wall; otherwise the character is stopped.

it has hit multiple things, we will not move the object

we use the average impact norm to get a tentative point where the biped is most likely to be in the next frame. we then cast another ray (group 1) from this tentative point to get another impact point. if there is no impact point within the radius of (fRadius+m_fSpeed * dTimeDelta), the object will move using the old facing vector. without further processing. Otherwise, from the two impact points(of group 0 and 1), we can calculate the wall direction vector, which will be used for sliding wall.

we will compute a tentative sliding wall facing(not the final one) as below: vFacing = vWallNorm (X) (vFacing (X) vWallNorm); and get a tentative new position of the character.

check if the hit sensor ray and the biped facing vector are on the same side of the wall vector. if so, it means that the biped is currently walking into the wall, otherwise it is leaving the wall. If the biped facing vector (V), the wall direction(W), and the hit ray direction (R), satisfies the condition ((R cross W) dot (V cross W))>=0, the character is still trying to walk into the wall, we will enforce wall sliding using wall direction vector, otherwise, the character will be allowed to move away using old direction.

we permit walking along the old facing vector. This is the case when the character is walking away from the wall.

Finally, we will also move the character slightly out of the wall, if it has run too deep in to it this is done by casting a third group of rays(group 2) from the newly computed position using the old facing vector. At this stage, we can know if the biped is in a corner by comparing sensor group 0 and 2. If the biped is cornered, the biped will be restored to its original position.

check to see if the character is in the air, or is climbing up stairs. if so we will see the bReachPos to false, and allow the character to smoothly fall down or fly up.

animate the character vertically according to gravity. implement smooth fall down and jump up.

§ ForceMove()

void CBipedObject::ForceMove ( )

Command the biped to move using its current facing (orientation).

the biped will continue walking until it is stopped or overridden by some other tasks.

§ GetAbsoluteSpeed()

float CBipedObject::GetAbsoluteSpeed ( )

get the magnitude of the current speed of the character.

this is always a non-negative value

§ GetAccelerationDist()

float ParaEngine::CBipedObject::GetAccelerationDist ( )

when m_fSpeed is set, this acceleration is used on m_fLastSpeed, before it reach m_fSpeed.

default to 0.f

§ GetAnimation()

int ParaEngine::CBipedObject::GetAnimation ( )
virtual

get the scaling.

Reimplemented from ParaEngine::CBaseObject.

§ GetAnimFrame()

int CBipedObject::GetAnimFrame ( )
virtual

get the current animation frame number relative to the beginning of current animation.

Reimplemented from ParaEngine::CBaseObject.

§ GetAnimInstance()

CAnimInstanceBase * CBipedObject::GetAnimInstance ( )

get the animation instance.

the size and speed of the animation and the biped object is not synchronized.

you need to manually get the current size and speed from the animation instance so that the biped and its animation instance could synchronize in action.

load the default animation

if there is no Stand animation, just call ForceStop to set the speed to zero

§ GetAssetHeight()

float ParaEngine::CBipedObject::GetAssetHeight ( )

get asset height.

§ GetAttachmentMatrix()

Matrix4 * ParaEngine::CBipedObject::GetAttachmentMatrix ( Matrix4 pOut,
int  nAttachmentID = 0,
int  nRenderNumber = 0 
)
virtual

Get the specified attachment matrix of the current model.

this is usually for getting the mount point on a certain model, such as horses. It also works for static mesh with xrefed mountable objects.

Parameters
pOutoutput result
nAttachmentIDsee ATTACHMENT_ID. default to 0, which is general mount point. ATT_ID_MOUNT1-9(20-28) is another mount points
Returns
: NULL if not attachment found, otherwise it is pOut.

get the mount point matrix using animation instance

Reimplemented from ParaEngine::CBaseObject.

§ GetAttributeClassID()

virtual int ParaEngine::CBipedObject::GetAttributeClassID ( )
inlinevirtual

attribute class ID should be identical, unless one knows how overriding rules work.

Reimplemented from ParaEngine::IGameObject.

Reimplemented in ParaEngine::CRpgCharacter, and ParaEngine::CRpgCharacter.

§ GetBipedStateManager()

CBipedStateManager * CBipedObject::GetBipedStateManager ( bool  bCreateOnDemand = true)
virtual

get biped state manager

Parameters
bCreateOnDemandif true, we will attempt to create the manager if it is not created before.
Returns
it may return NULL if bCreateOnDemand is false.

Reimplemented from ParaEngine::CBaseObject.

§ GetBootHeight()

float ParaEngine::CBipedObject::GetBootHeight ( )

get boot height, default to 0.f meters.

It only affects rendering. In case, the character is wearing a high heel boot, we may set this to 0.1-0.2 meters.

§ GetCharModelInstance()

CharModelInstance * CBipedObject::GetCharModelInstance ( )

get the character model instance.

This function will return NULL, if there is no character model instance associated with this node

§ GetChildAttributeColumnCount()

int ParaEngine::CBipedObject::GetChildAttributeColumnCount ( )
virtual

we support multi-dimensional child object.

by default objects have only one column.

Reimplemented from ParaEngine::CBaseObject.

§ GetChildAttributeObject()

IAttributeFields * ParaEngine::CBipedObject::GetChildAttributeObject ( const std::string &  sName)
virtual

get attribute by child object.

used to iterate across the attribute field hierarchy.

Reimplemented from ParaEngine::CBaseObject.

§ GetChildAttributeObjectCount()

int ParaEngine::CBipedObject::GetChildAttributeObjectCount ( int  nColumnIndex = 0)
virtual

get the number of child objects (row count) in the given column.

please note different columns can have different row count.

Reimplemented from ParaEngine::CBaseObject.

§ GetCurrentAnimation()

int CBipedObject::GetCurrentAnimation ( )

get the ID of the current animation.

§ GetDefaultReplaceableTexture()

TextureEntity * ParaEngine::CBipedObject::GetDefaultReplaceableTexture ( int  ReplaceableTextureID)
virtual

get the default replaceable texture by its ID.

The default replaceable texture is the main texture exported from the 3dsmax exporter.

Parameters
ReplaceableTextureIDusually [0-32) generally speaking, replaceable ID 0 is used for general purpose replaceable texture, ID 1 is for user defined. ID 2 is for custom skins.
Returns
this may return NULL, if replaceable texture is not set before or ID is invalid.

Reimplemented from ParaEngine::CBaseObject.

§ GetHeadTurningAngle()

float CBipedObject::GetHeadTurningAngle ( )

get the head facing.It is relative to the model facing.

§ GetHeadUpdownAngle()

float ParaEngine::CBipedObject::GetHeadUpdownAngle ( )

get the head facing.It is relative to the model facing.

§ GetIsAlwaysAboveTerrain()

bool ParaEngine::CBipedObject::GetIsAlwaysAboveTerrain ( )
inlineprotected

get whether character should always above terrain during movement.

§ GetIsAnimPaused()

bool ParaEngine::CBipedObject::GetIsAnimPaused ( )
inlineprotected

true to pause animation.

default to false. this is usually to freeze the biped and use Frame Number to control its animation.

§ GetLastSpeed()

float ParaEngine::CBipedObject::GetLastSpeed ( )

this is not used, unless, speed acceleration is positive.

§ GetLastWayPoint()

BipedWayPoint & CBipedObject::GetLastWayPoint ( )

get the last way point.

if the way point is empty, a INVALID_WAYPOINT type is returned.

§ GetMaxSpeed()

float CBipedObject::GetMaxSpeed ( )

get the maximum speed of the character.

Currently it is just the walk speed of the character.

§ GetNumReplaceableTextures()

int ParaEngine::CBipedObject::GetNumReplaceableTextures ( )
virtual

get the total number of replaceable textures, which is the largest replaceable texture ID.

but it does not mean that all ID contains valid replaceable textures. This function can be used to quickly decide whether the model contains replaceable textures. Generally we allow 32 replaceable textures per model.

Returns
0 may be returned if no replaceable texture is used by the model.

Reimplemented from ParaEngine::CBaseObject.

§ GetOBB()

void ParaEngine::CBipedObject::GetOBB ( CShapeOBB obb)
virtual

get the oriented bounding box in world space.

One may need to shift by the rendering origin if used on that purposes.

Parameters
obb[out]

Reimplemented from ParaEngine::CTileObject.

§ GetParaXAnimInstance()

CParaXAnimInstance * CBipedObject::GetParaXAnimInstance ( )

get the ParaX animation instance.

This function will return NULL, if GetAnimInstance() is not a ParaX AnimInstance

§ GetParaXEntity()

ParaEngine::ParaXEntity * ParaEngine::CBipedObject::GetParaXEntity ( )
protected

get parax asset entity if its type is ParaX model.

§ GetPhysicsBBObj()

CBaseObject * CBipedObject::GetPhysicsBBObj ( )

get a base object containing the bounding box of the physical biped.

this function is used to draw the bounding box of the physics of a biped object in debug mode.

Returns
: the pointer to the bounding box object is returned. NOTE: this BB(bounding box) object pointer is only valid until the next call to this method. internally, it just returns the pointer to a static base object, which is initialized according to the physics of this biped instance.

§ GetPhysicsGroup()

int ParaEngine::CBipedObject::GetPhysicsGroup ( )
virtual

Get the physics group ID to which this object belongs to default to 0, must be smaller than 32.

please see groups Mask used to filter shape objects. See #NxShape::setGroup

  • group 0 means physics object that will block the camera and player, such as building walls, big tree trunks, etc.
  • group 1 means physics object that will block the player and standard mouse picking, but not the camera, such as small stones, thin posts, trees, etc.
  • group 2 means physics object that will block the player, but not the camera or mouse picking, such as transparent wall to prevent user to walk on.

Reimplemented from ParaEngine::CBaseObject.

§ GetPhysicsGroupMask()

DWORD ParaEngine::CBipedObject::GetPhysicsGroupMask ( )
virtual

get groups Mask used to filter physics objects, default to 0xffffffff.

groups Mask used to specify which groups of physics object this biped will collide with. In most cases, only mesh object's physics group needs to be configured.

Reimplemented from ParaEngine::CBaseObject.

§ GetPhysicsHeight()

float CBipedObject::GetPhysicsHeight ( )

the biped is modeled as a cylinder or sphere during rough physics calculation.

this function returns the height of the cylinder or sphere.

§ GetPhysicsRadius()

float CBipedObject::GetPhysicsRadius ( )
virtual

the biped is modeled as a cylinder or sphere during rough physics calculation.

this function returns the radius of the cylinder or sphere.

Reimplemented from ParaEngine::CBaseObject.

§ GetRenderMatrix()

Matrix4 * CBipedObject::GetRenderMatrix ( Matrix4 pOut,
int  nRenderNumber = 0 
)
virtual

get the world transformation matrix for the current object.

Returns
: return pOut

get world position from the mount point

get the mount point matrix on the target model. attachment ID=0 is the mount point

Set world position: mount position+target position==>new world position for the mounted model.

Reimplemented from ParaEngine::IViewClippingObject.

§ GetReplaceableTexture()

TextureEntity * ParaEngine::CBipedObject::GetReplaceableTexture ( int  ReplaceableTextureID)
virtual

get the current replaceable texture by its ID.

if no replaceable textures is set before, this will return the same result as GetNumReplaceableTextures().

Note
: This function will cause the mesh entity to be initialized.
Parameters
ReplaceableTextureIDusually [0-32) generally speaking, replaceable ID 0 is used for general purpose replaceable texture, ID 1 is for user defined. ID 2 is for custom skins.
Returns
this may return NULL, if replaceable texture is not set before or ID is invalid.

Reimplemented from ParaEngine::CBaseObject.

§ GetSizeScale()

float CBipedObject::GetSizeScale ( )
virtual
See also
SetSizeScale

Reimplemented from ParaEngine::IGameObject.

§ GetSpeed()

float CBipedObject::GetSpeed ( )

get the magnitude of the current speed of the character.

Please note that this value may be negative.

§ GetSpeedAngle()

float CBipedObject::GetSpeedAngle ( )

get the speed direction for physics.

§ GetSpeedDirection()

void CBipedObject::GetSpeedDirection ( Vector3 pV)

get the direction vector according to speed angle of current biped.

if the speed is negative, the direction will be turned 180 degrees. in other words, this direction is always the direction where the biped should progress. it is used for physics calculation.

§ GetSpeedScale()

float CBipedObject::GetSpeedScale ( )
virtual
See also
SetSpeedScale

Reimplemented from ParaEngine::IGameObject.

§ GetStaticActorCount()

int ParaEngine::CBipedObject::GetStaticActorCount ( )

get the number of physics actors.

If physics is not loaded, the returned value is 0.

§ GetTime()

int ParaEngine::CBipedObject::GetTime ( )
virtual

get the current local time in case it is animated in milli seconds frames.

Reimplemented from ParaEngine::IAttributeFields.

§ GetVerticalSpeed()

float CBipedObject::GetVerticalSpeed ( )

get the vertical speed of the character.

0.f is returned if it does not have a vertical speed.

§ HasAlphaBlendedObjects()

bool ParaEngine::CBipedObject::HasAlphaBlendedObjects ( )
virtual

return true if the object contains alpha blended render pass.

This function determines which render pipeline stage the object is rendered. generally speaking, if deferred shading is used, we will render alpha blended objects last.

Reimplemented from ParaEngine::CBaseObject.

§ HasAnimation()

bool ParaEngine::CBipedObject::HasAnimation ( int  nAnimID)
virtual

whether an animation id exist.

this function may have different return value when asset is async loaded.

Parameters
nAnimIDpredefined id.

§ HasAnimId()

bool ParaEngine::CBipedObject::HasAnimId ( int  nAnimID)

check to see if the underlying model has a given animation id.

§ HasAttachmentPoint()

bool ParaEngine::CBipedObject::HasAttachmentPoint ( int  nAttachmentID = 0)
virtual

whether it has an attachment point

Parameters
nAttachmentIDsee ATTACHMENT_ID. default to 0, which is general mount point. ATT_ID_MOUNT1-9(20-28) is another mount points

Reimplemented from ParaEngine::CBaseObject.

§ InitObject()

HRESULT CBipedObject::InitObject ( AssetEntity pMAE)

Set the base character model.

Desc: It saves device references, but do not initialize those devices.

it only does initialization not concerning device object. Object dependent initialization is done with InitDeviceObjects().

§ InstallFields()

int CBipedObject::InstallFields ( CAttributeClass pClass,
bool  bOverride 
)
virtual

this class should be implemented if one wants to add new attribute.

This function is always called internally.

Reimplemented from ParaEngine::IGameObject.

Reimplemented in ParaEngine::CRpgCharacter, and ParaEngine::CRpgCharacter.

§ IsAutoWalkupBlock()

bool ParaEngine::CBipedObject::IsAutoWalkupBlock ( )

whether automatically walk up block that is 1 block high in front of us.

§ IsBipedBlocked()

bool CBipedObject::IsBipedBlocked ( )

If the biped is currently blocked.

When in blocking mode.The biped is also in standing mode. But in rare cases, a biped has not been evaluated by the environment simulator, the biped might be in walking state while in blocking mode. But this is only for a very short moment between calls of environment simulation.

§ IsStandingIntentioned()

bool CBipedObject::IsStandingIntentioned ( )

return true, if the biped is not only standing now, but also intends to remain standing for the next frame.

§ IsUseGlobalTime()

bool CBipedObject::IsUseGlobalTime ( )
virtual

whether to use global time to sync animation.

Default to false. if true, all characters plays exactly the same frames if they are using the same animation file at all times, if false, each character advances its time frame separately according to their visibility in the scene.

Note
: animation is always looped once use global time

Reimplemented from ParaEngine::CBaseObject.

§ JumpUpward()

void CBipedObject::JumpUpward ( float  fVerticalSpeed,
bool  bJumpFromGround 
)

jump up.

it gives a character a vertical impulse. i.e. a vertical speed.

Parameters
fVerticalSpeedthe upward speed of the character after the jump
bJumpFromGroundif this is true, the impulse will only be given if the character is currently on the ground. i.e. its current vertical speed is 0.

§ LoadStoredModel()

void CBipedObject::LoadStoredModel ( int  nModelSetID)

Load a stored model in data base by the model set ID.

A stored model usually contain the attachments and equipments, but not the base model. This function is only valid when the base model has already been set.

Parameters
nModelSetIDthe ID of the model set in the database. Some ID may be reserved for user-specified model

§ MountOn()

bool CBipedObject::MountOn ( CBaseObject pTarget,
int  nMountID = -1 
)

mount the current character on the target

Parameters
pTargetif NULL, it will unmount.
nMountIDthe attachment ID of the model. if -1 (default), we will attach to the nearest mount position.

§ MoveTowards()

bool CBipedObject::MoveTowards ( double  dTimeDelta,
const DVector3 vPosTarget,
float  fStopDistance,
bool *  pIsSlidingWall = NULL 
)
protected

Move the biped in the physical scene.move the biped towards the target using its current speed and facing the biped may slide along a wall or be stopped.

dTimeDelta: time delta in seconds. vPosTarget: destination point in world coordinate system. fStopDistance: if the character is within this distance to the target, then it is stopped pIsSlidingWall: [out] whether the object is sliding along a wall

Returns
: return true if the biped already reached the destination.

check to see if the maximum penetration distance allowed. In each simulation step, if the biped moves longer than this step, it is further divided in to several evenly spaced steps. the step length is determined by the biped's speed multiplied by the time delta. See also NX_MIN_SEPARATION_FOR_PENALTY, and CBipedObject::MoveTowards()

ignore PENETRATION_DISTANCE, if it takes longer than MAX_STEPS_PER_FRAME per frame.

check whether the biped is under water. if so set water state. the acceleration of biped under water is Gw= (1-e/D)*G -(V*V)*k where G is gravity of the earth, D is the density of the object, V is the vertical speed of the biped. e is the percentage of object body under water. It is 1 when object is completely underwater, and (0,1) when partially underwater, and 0 when not underwater. k denotes water resistance, which is 0.1f.

the larger the more resistance between [0,1].

when an object is crossing the water/air surface with a speed less than WATER_SKIP_VELOCITY m/s, we will not allow the object to escape to air or water, but rather floating at the height of m_fDensity*fHeight;

the fall down speed should be small.

when an object is crossing the water/air surface with a speed less than WATER_SKIP_VELOCITY m/s, we will not allow the object to escape to air or water, but rather floating at the height of m_fDensity*fHeight;

true to ignore global terrain physics. The object will fall through the global terrain. This is automatically set by the MoveTowards() method. If the height of the object is well below of the global terrain surface, it is assumed to be underground, such as in the cave or tunnel. The camera will also ignore collision with the terrain objects.

if we're within reach, we will stop without reaching the exact target point

  • Cast a group of n (n=3) rays (group 0) in front of the character, which covers a region of (n-2)/(n-1)*Pi radian. if several sensor rays hit some obstacles within the radius of the object, we will see if the world impact normals are roughly the same. If so, the character is considered to be blocked by a single wall..In case of a single blocking wall,we will try slide the character along the wall; otherwise the character is stopped.

it has hit multiple things, we will not move the object

we use the average impact norm to get a tentative point where the biped is most likely to be in the next frame. we then cast another ray (group 1) from this tentative point to get another impact point. if there is no impact point within the radius of (fRadius+m_fSpeed * dTimeDelta), the object will move using the old facing vector. without further processing. Otherwise, from the two impact points(of group 0 and 1), we can calculate the wall direction vector, which will be used for sliding wall.

we will compute a tentative sliding wall facing(not the final one) as below: vFacing = vWallNorm (X) (vFacing (X) vWallNorm); and get a tentative new position of the character.

check if the hit sensor ray and the biped facing vector are on the same side of the wall vector. if so, it means that the biped is currently walking into the wall, otherwise it is leaving the wall. If the biped facing vector (V), the wall direction(W), and the hit ray direction (R), satisfies the condition ((R cross W) dot (V cross W))>=0, the character is still trying to walk into the wall, we will enforce wall sliding using wall direction vector, otherwise, the character will be allowed to move away using old direction.

check if the hit sensor ray and the biped facing vector are on the same side of the wall vector. if so, it means that the biped is currently walking into the wall, otherwise it is leaving the wall. If the biped facing vector (V), the wall direction(W), and the hit ray direction (R), satisfies the condition ((R cross W) dot (V cross W))>=0, the character is still trying to walk into the wall, we will enforce wall sliding using wall direction vector, otherwise, the character will be allowed to move away using old direction.

we permit walking along the old facing vector. This is the case when the character is walking away from the wall.

Finally, we will also move the character slightly out of the wall, if it has run too deep in to it this is done by casting a third group of rays(group 2) from the newly computed position using the old facing vector. At this stage, we can know if the biped is in a corner by comparing sensor group 0 and 2. If the biped is cornered, the biped will be restored to its original position.

check to see if the character is in the air, or is climbing up stairs. if so we will see the bReachPos to false, and allow the character to smoothly fall down or fly up.

take terrain in to account, we will adopt the higher of the two as the character's next height.

if the object is not too far from the ground, it will subject to terrain surface norm.

if the object is well above the ground(in air), it will not snap to terrain surface norm.

animate the character vertically according to gravity. implement smooth fall down and jump up.

if the character is above the ground, use the current vertical velocity.

this ensures that flyable object will fly when in air. We do so, by setting the maximum vertical speed for flying object. maximum vertical speed is proportional to the density. The closer to 0, the smaller the maximum vertical speed.

end jumping, if the biped is near the ground and has a downward vertical speed.

fall down, if the biped is well above the ground and has a downward vertical speed.

if the character is below the ground, ensure that the character has at least max(CLIMBUP_SPEED,current_speed) unless it already has a bigger vertical speed.

end jumping, if the biped is below the ground

if the character is on the ground, make sure that it has a non-negative speed

§ MoveTowards_Linear()

bool ParaEngine::CBipedObject::MoveTowards_Linear ( double  dTimeDelta,
const DVector3 vPosTarget 
)
protected

move as an OPC.

see PhysicsMoveStyle::MOVESTYLE_LINEAR

Returns
: return true if the biped already reached the destination.

§ MoveTowards_OPC()

bool ParaEngine::CBipedObject::MoveTowards_OPC ( double  dTimeDelta,
const DVector3 vPosTarget,
float  fQuickMoveDistance = 15.f 
)
protected

move as an OPC.

see PhysicsMoveStyle::MOVESTYLE_OPC

Parameters
fQuickMoveDistanceif destination is longer than this value, we will how many meters to quick move
Returns
: return true if the biped already reached the destination.
Parameters
fQuickMoveDistanceif positive value, it is distance. if negative values, it is seconds. where fQuickMoveDistance = (-fQuickMoveDistance)*Speed;

§ On_Click()

int CBipedObject::On_Click ( DWORD  nMouseKey,
DWORD  dwParam1,
DWORD  dwParam2 
)
virtual

when the player clicked on this object.

This function will be automatically called by the environment simulator.

Reimplemented from ParaEngine::IGameObject.

§ On_EnterSentientArea()

int CBipedObject::On_EnterSentientArea ( )
virtual

when other game objects of a different type entered the sentient area of this object.

This function will be automatically called by the environment simulator.

Reimplemented from ParaEngine::IGameObject.

§ On_Event()

int CBipedObject::On_Event ( DWORD  nEventType,
DWORD  dwParam1,
DWORD  dwParam2 
)
virtual

TODO: Some game defined events, such as user attack, etc.

Reimplemented from ParaEngine::IGameObject.

§ On_FrameMove()

int CBipedObject::On_FrameMove ( )
virtual

called every frame move when this character is sentient.

This is most likely used by active AI controllers, such as movie controller.

Reimplemented from ParaEngine::IGameObject.

§ On_LeaveSentientArea()

int CBipedObject::On_LeaveSentientArea ( )
virtual

when no other game objects of different type is in the sentient area of this object.

This function will be automatically called by the environment simulator.

Reimplemented from ParaEngine::IGameObject.

§ On_Net_Receive()

int CBipedObject::On_Net_Receive ( DWORD  dwNetType,
DWORD  dwParam1,
DWORD  dwParam2 
)
virtual

when the network module receives packages from the network and it is about a certain game object.

Then this function will be automatically called. In this function, the game object may read the network packages and act accordingly.

Reimplemented from ParaEngine::IGameObject.

§ On_Net_Send()

int CBipedObject::On_Net_Send ( DWORD  dwNetType,
DWORD  dwParam1,
DWORD  dwParam2 
)
virtual

during the execution of this object, it may send various network commands to the server or client.

the network module will decide when to group these commands and send them over the network in one package. this function will be called when such network package is being prepared.

Reimplemented from ParaEngine::IGameObject.

§ On_Perception()

int CBipedObject::On_Perception ( )
virtual

when other game objects of a different type entered the perceptive area of this object.

This function will be automatically called by the environment simulator.

Reimplemented from ParaEngine::IGameObject.

§ OneObstaclePathFinding()

void CBipedObject::OneObstaclePathFinding ( CBaseObject pSolid)

give a precise solution, in which the biped is guaranteed to be approaching the destination point.

pSolid is the object that blocks the way.

if the object can be moved directly to the target, then move it without adding additional points

we will add path_finding points in order to reach the target.

we will talk in the tangent of the object from the source position a fixed length(0.5units).

Note: I only tested x,z, I care not about the y component, which is related to object's height

§ PathFinding()

void CBipedObject::PathFinding ( double  dTimeDelta)
virtual

environment simulator call these functions

desc: this function is called by the environment simulator, when needed.

The biped object then get an opportunity to shun from any obstacles or try to solve collisions by generating additional way points.

rule1: we will not foresee any further, but implement path-finding only when there is already collisions between this biped and the environment.

rule2: if there have been collisions in the way, we will see whether we have already given solutions in the previous path-finding process.If so, we will not generate new ones nor canceling it

rule 3: we will only generate a solution when the next way point is a command type point.

already reached destination, we will go on to the next way point in the queue when there is collision, we will regard a circle(with a radius) as the destination point. while in free-collision condition, a destination is really a point.

See whether there are bipeds that are moving. If so, block the current biped for some seconds or if the destination point(radius 0.01f*OBJ_UNIT)is inside one of the object, remove the way point Get the biggest non-mobile object

We will only solve against the biggest static object, we can give very precise solution according to its shape, when there is only one object.

Reimplemented from ParaEngine::IGameObject.

§ PlayAnimation() [1/2]

void CBipedObject::PlayAnimation ( DWORD  nIndex,
bool  bUpdateSpeed = true,
bool  bAppend = false 
)

Plat a specified animation by its animation index.

Parameters
nIndexthe animation index.
bUpdateSpeedwhether to update the biped's speed according to the one defined in the animation. the default value is true.
bAppendif true, the new animation will be appended to the current animation according to the following rules:
  • if the current animation is non-looping, the new animation will be played after the end of the current animation.
  • if the current animation is looping, the new animation will be played immediately.

§ PlayAnimation() [2/2]

void CBipedObject::PlayAnimation ( const char *  sName,
bool  bUpdateSpeed = true,
bool  bAppend = false 
)

Plat a specified animation by its animation name.

Parameters
sNamethe animation name.Please see the ParaXAnimationInstance for some predefined animation names.
bUpdateSpeedwhether to update the biped's speed according to the one defined in the animation. the default value is true.
bAppendif true, the new animation will be appended to the current animation according to the following rules:
  • if the current animation is non-looping, the new animation will be played after the end of the current animation.
  • if the current animation is looping, the new animation will be played immediately.

§ PopParam()

void CBipedObject::PopParam ( )
virtual

Usually, this is used in canvas drawing.

So that the same object can be used in different scene manager. Parameter includes: position, facing, facing target, speed, etc.

Note
: must be paired with PushParam(). currently, it does not use a stack for storing parameters, but a simple set of globals. So only one level push/pop operation is supported.

Reimplemented from ParaEngine::CBaseObject.

§ ProcessObjectEvent()

int ParaEngine::CBipedObject::ProcessObjectEvent ( const ObjectEvent event)
virtual

this function is only used to backward compatibility of ParaObject:AddEvent() function.

Reimplemented from ParaEngine::IObject.

§ PushParam()

void CBipedObject::PushParam ( )
virtual

Usually, this is used in canvas drawing.

So that the same object can be used in different scene manager. Parameter includes: position, facing, facing target, speed, etc.

Note
: must be paired with PopParam(). currently, it does not use a stack for storing parameters, but a simple set of globals. So only one level push/pop operation is supported.

Reimplemented from ParaEngine::CBaseObject.

§ QueryIGameObject()

IGameObject * CBipedObject::QueryIGameObject ( )
virtual

this may return NULL, if the object does not implement the IGameObject interface.

Reimplemented from ParaEngine::CBaseObject.

§ ReplaceAIModule()

void CBipedObject::ReplaceAIModule ( CAIBase pNew)

replace the current AI module with a new one.

pNew can be NULL,in which case the old module is deleted

§ Reset()

void CBipedObject::Reset ( )
virtual

reset the object to its default settings.

Reimplemented from ParaEngine::CBaseObject.

§ ResetBaseModel()

void CBipedObject::ResetBaseModel ( AssetEntity assetCharBaseModel)

Reset base model.

Base model is the frame model, to which other sub-models like weapons and clothing are attached. NOTE: the current version will delete the entire model instance, so that any sub-models attached to this model will be deleted and that the default appearance of the base model will show up, if one does not update its equipment after this call.

Parameters
assetCharBaseModelIt is the new base model asset;it should be a valid ParaX model asset.

§ Rotate()

void CBipedObject::Rotate ( float  x,
float  y,
float  z 
)
virtual

Rotate the object.This only takes effects on objects having 3D orientation, such as static mesh and physics mesh.

The orientation is computed in the following way: first rotate around x axis, then around y, finally z axis.

Parameters
xrotation around the x axis.
yrotation around the y axis.
zrotation around the z axis.

Reimplemented from ParaEngine::IViewClippingObject.

§ SetAnimation()

void ParaEngine::CBipedObject::SetAnimation ( int  nAnimID)
virtual

Set the current animation id.

Parameters
nAnimID0 is default standing animation. 4 is walking, 5 is running. more information, please see AnimationID

Reimplemented from ParaEngine::CBaseObject.

§ SetAnimFrame()

void CBipedObject::SetAnimFrame ( int  nFrame)
virtual

set the current animation frame number relative to the beginning of current animation.

Parameters
nFrame0 means beginning. if nFrame is longer than the current animation length, it will wrap (modulate the length).

Reimplemented from ParaEngine::CBaseObject.

§ SetAutoWalkupBlock()

void ParaEngine::CBipedObject::SetAutoWalkupBlock ( bool  bAutoWalkup)

whether automatically walk up block that is 1 block high in front of us.

§ SetBlendingFactor()

void ParaEngine::CBipedObject::SetBlendingFactor ( float  fBlendingFactor)
protected

set the blending factor between the current and blend animation.

Parameters
fBlendingFactorfrom [0,1]. where 0 means no blending.

§ SetBootHeight()

void ParaEngine::CBipedObject::SetBootHeight ( float  fBootHeight)

set boot height, default to 0.f meters.

It only affects rendering. In case, the character is wearing a high heel boot, we may set this to 0.1-0.2 meters.

§ SetDensity()

void CBipedObject::SetDensity ( float  fDensity)

body density.

The water density is always 1.0 in the game engine. So if it is above 1.0, it will sink in water; otherwise it will float on water surface. So if it is below 0.5, it will fly or glind in air falling down with little gravity; otherwise it will fall down with full gravity. A density of 0 or negative, means that the character can fly. The default value is 1.2. the following are some examples

  • character: body density: 1.2
  • car: body density: 2.0 mount target
  • ship: body density: 0.8 mount target
  • plane: body density: 0.4 mount target
    Parameters
    fDensity

§ SetHeadTurningAngle()

void CBipedObject::SetHeadTurningAngle ( float  fFacing)

set the facing of model's head.

It is relative to the model facing. Please note that if the head facing is not in the range [-Pi/2,Pi/2], the head facing will be set to its edge value.

§ SetHeadUpdownAngle()

void ParaEngine::CBipedObject::SetHeadUpdownAngle ( float  fFacing)

set the facing of model's head.

It is relative to the model facing. Please note that if the head facing is not in the range [-Pi/2,Pi/2], the head facing will be set to its edge value.

§ SetIsAlwaysAboveTerrain()

void ParaEngine::CBipedObject::SetIsAlwaysAboveTerrain ( bool  bEnable)
inlineprotected

set whether character should always above terrain during movement.

§ SetIsAnimPaused()

void ParaEngine::CBipedObject::SetIsAnimPaused ( bool  bPaused)
inlineprotected

true to pause animation.

default to false. this is usually to freeze the biped and use Frame Number to control its animation.

§ SetOnAssetLoaded()

void CBipedObject::SetOnAssetLoaded ( const char *  sCallbackScript)
virtual

set the callback scipt whenever the primary asset is successfully loaded.

Reimplemented from ParaEngine::CBaseObject.

§ SetParamsFromAsset()

bool CBipedObject::SetParamsFromAsset ( )
protected

set params from asset when the asset is available (async asset loading)

load the default animation

if there is no Stand animation, just call ForceStop to set the speed to zero

§ SetPhysicsGroup()

void ParaEngine::CBipedObject::SetPhysicsGroup ( int  nGroup)
virtual

set the physics group ID to which this object belongs to default to 0, must be smaller than 32.

please see groups Mask used to filter shape objects. See #NxShape::setGroup

  • group 0 means physics object that will block the camera and player, such as building walls, big tree trunks, etc.
  • group 1 means physics object that will block the player, but not the camera, such as small stones, thin posts, trees, etc.

Reimplemented from ParaEngine::CBaseObject.

§ SetPhysicsGroupMask()

void ParaEngine::CBipedObject::SetPhysicsGroupMask ( DWORD  dwValue)
virtual

set groups Mask used to filter physics objects, default to 0xffffffff.

groups Mask used to specify which groups of physics object this biped will collide with. In most cases, only mesh object's physics group needs to be configured.

Reimplemented from ParaEngine::CBaseObject.

§ SetPhysicsHeight()

void CBipedObject::SetPhysicsHeight ( float  fH)

the biped is modeled as a cylinder or sphere during rough physics calculation.

this function sets the height of the cylinder or sphere.

§ SetPhysicsRadius()

void CBipedObject::SetPhysicsRadius ( float  fR)

the biped is modeled as a cylinder or sphere during rough physics calculation.

this function set the radius of the cylinder or sphere.

§ SetPrimaryTechniqueHandle()

void ParaEngine::CBipedObject::SetPrimaryTechniqueHandle ( int  nHandle)
virtual

Set a new render technique handle.

If the effect file associated with the handle is invalid or do not share the same input declaration as the object at the time of drawing, the object will not be drawn or will be drawn improperly. This function rarely needs to be called by users. Technique handles are usually automatically assigned by the game engine when the asset file is loaded. Of course, users can use special effect files for the rendering of special objects; then this function needs to be called.

Parameters
nHandle
See also
TechniqueHandle

Reimplemented from ParaEngine::CBaseObject.

§ SetReplaceableTexture()

bool ParaEngine::CBipedObject::SetReplaceableTexture ( int  ReplaceableTextureID,
TextureEntity pTextureEntity 
)
virtual

set the replaceable texture at the given index with a new texture.

this function will succeed regardless whether the mesh is initialized. Hence it can be used at loading time. because default instance of the mesh may use different replaceable texture set.

Parameters
ReplaceableTextureIDusually [0-32) generally speaking, replaceable ID 0 is used for general purpose replaceable texture, ID 1 is for user defined. ID 2 is for custom skins.
pTextureEntityThe reference account of the texture entity will be automatically increased by one.
Returns
true if succeed. if ReplaceableTextureID exceed the total number of replaceable textures, this function will return false.

Reimplemented from ParaEngine::CBaseObject.

§ SetScaling()

void CBipedObject::SetScaling ( float  s)
virtual

set the scale of the object.

This function takes effects on both character object and mesh object.

Parameters
sscaling applied to all axis.1.0 means original size.

Reimplemented from ParaEngine::IViewClippingObject.

§ SetSizeScale()

void CBipedObject::SetSizeScale ( float  dScale)
virtual

set the size of the object to dScale times of its original size.

usually this value is 1.0

set scale of the associated mesh

Reimplemented from ParaEngine::IGameObject.

§ SetSpeed()

void CBipedObject::SetSpeed ( float  fSpeed)

set the magnitude of the current speed of the character.

§ SetSpeedAngle()

void CBipedObject::SetSpeedAngle ( float  fSpeedAngle)

set the current speed angle.

Parameters
fSpeedAnglethe new speed direction of the biped. It will be immediately used for physics.
bSmoothRenderwhether the biped will smoothly turn to that direction during rendering. the default value is true.

§ SetUseGlobalTime()

void CBipedObject::SetUseGlobalTime ( bool  bUseGlobalTime)
virtual

whether to use global time to sync animation.

Default to false. if true, all characters plays exactly the same frames if they are using the same animation file at all times, if false, each character advances its time frame separately according to their visibility in the scene.

Note
: animation is always looped once use global time

Reimplemented from ParaEngine::CBaseObject.

§ SetUserControl()

void CBipedObject::SetUserControl ( )
virtual

Desc: Specifies whether this instance of CBipedObject is controlled by the user or the program.

§ SetVerticalSpeed()

void CBipedObject::SetVerticalSpeed ( float  fSpeed)

Set the vertical speed of the character.

0.f is returned if it does not have a vertical speed.

§ SetWalkingState()

void CBipedObject::SetWalkingState ( const char *  sName = NULL)

Walk using specified animation.

Parameters
sNameThe name of the walking animation. if sName == NULL, the default walking animation will be loaded

§ SetYaw()

void CBipedObject::SetYaw ( float  fFacing)
virtual

set model facing to the specified value.

Reimplemented from ParaEngine::CTileObject.

§ ToString()

std::string CBipedObject::ToString ( DWORD  nMethod)
virtual

convert the object to an NPL string by which this object may be created or deleted.

Parameters
nMethodbit combination of CBaseObject::NPL_STRING

just a comment line with its name.

just a comment line with its name.

Reimplemented from ParaEngine::CBaseObject.

§ UpdateGeometry()

void ParaEngine::CBipedObject::UpdateGeometry ( )
virtual

update the local transform from size, roll, pitch, yaw, etc.

uncomment to let the physics radius automatically scales

Reimplemented from ParaEngine::CBaseObject.

§ UpdateSpeed()

void CBipedObject::UpdateSpeed ( float  fSpeed)

update the biped's speed.

Parameters
fSpeedthis is usually the input from the animation speed.

§ UpdateState()

void CBipedObject::UpdateState ( float  fTimeDelta)
protected

this function is only called by the AnimateBiped() to update states for active bipeds.

§ UseAIModule()

CAIBase * CBipedObject::UseAIModule ( const string &  sAIType)

use a specified AI object.

Parameters
sAITypevalid AI object is: "NPC"|""|"NULL" "" is the same as "NPC" "NULL" means no AI module.
Returns
: the current ai object is returned.

§ UseSpeedFromAnimation() [1/2]

void CBipedObject::UseSpeedFromAnimation ( int  nIndex)

use the speed defined in a specified animation by its animation index.

Parameters
nIndexthe animation index.

§ UseSpeedFromAnimation() [2/2]

void CBipedObject::UseSpeedFromAnimation ( const char *  sName)

use the speed defined in a specified animation by its animation name.

Parameters
sNamethe animation name.Please see the ParaXAnimationInstance for some predefined animation names.

§ ViewTouch()

bool ParaEngine::CBipedObject::ViewTouch ( )
virtual

this function is called, when the object is in view range.

we may need to load the primary asset to update the bounding box, etc.

Reimplemented from ParaEngine::CBaseObject.

§ WalkTo()

void CBipedObject::WalkTo ( const DVector3 pV,
bool  bIgnoreHeight = true 
)

force the biped to walk to a position.

The action is carried out immediately. the biped might still be blocked after calling this function. In some cases, one should check if a biped is already blocked before calling it to walk again.


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