- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# FCDocument/FCDPhysicsRigidBodyInstance.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2005-2007 Feeling Software Inc.
    00003     Portions of the code are:
    00004     Copyright (C) 2005-2007 Sony Computer Entertainment America
    00005
    00006     MIT License: http://www.opensource.org/licenses/mit-license.php
    00007 */
    00008
    00014 #ifndef _FCD_PHYSICS_RIGID_BODY_ENTITY_H_
    00015 #define _FCD_PHYSICS_RIGID_BODY_ENTITY_H_
    00016
    00017 #ifndef _FCD_ENTITY_INSTANCE_H_
    00018 #include "FCDocument/FCDEntityInstance.h"
    00019 #endif // _FCD_ENTITY_INSTANCE_H_
    00020 #ifndef _FCD_PARAMETER_ANIMATABLE_H_
    00021 #include "FCDocument/FCDParameterAnimatable.h"
    00022 #endif // _FCD_PARAMETER_ANIMATABLE_H_
    00023
    00024 class FCDocument;
    00025 class FCDSceneNode;
    00026 class FCDPhysicsRigidBody;
    00027 class FCDPhysicsRigidBodyParameters;
    00028 class FCDPhysicsMaterial;
    00029 class FCDPhysicsModelInstance;
    00030 template <class Arg1, class Arg2> class FUEvent2;
    00031
    00032
    00040 class FCOLLADA_EXPORT FCDPhysicsRigidBodyInstance : public FCDEntityInstance
    00041 {
    00042 private:
    00043     DeclareObjectType(FCDEntityInstance);
    00044
    00045     FCDPhysicsModelInstance* parent;
    00046     typedef FUEvent2<FCDPhysicsRigidBodyInstance*, const FMVector3&> CollisionEvent;
    00047     CollisionEvent* onCollisionEvent;
    00048
    00049     DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, velocity, FC("Initial Linear Velocity"));
    00050     DeclareParameterAnimatable(FMVector3, FUParameterQualifiers::VECTOR, angularVelocity, FC("Initial Angular Velocity"));
    00051     DeclareParameterRef(FCDPhysicsRigidBodyParameters, parameters, FC("Parameters"));
    00052     DeclareParameterPtr(FCDSceneNode, targetNode, FC("Target Node"));
    00053
    00054
    00055 public:
    00065     FCDPhysicsRigidBodyInstance(FCDocument* document, FCDPhysicsModelInstance* _parent, FCDPhysicsRigidBody* body);
    00066
    00068     virtual ~FCDPhysicsRigidBodyInstance();
    00069
    00073     virtual Type GetType() const { return PHYSICS_RIGID_BODY; }
    00074
    00078     FCDPhysicsModelInstance* GetModelParentInstance(){ return parent; }
    00079
    00082     FCDPhysicsRigidBodyParameters* GetParameters() { return parameters; }
    00083     const FCDPhysicsRigidBodyParameters* GetParameters() const { return parameters; }
    00087     inline FCDPhysicsRigidBody* GetRigidBody() { return (FCDPhysicsRigidBody*) GetEntity(); }
    00088
    00091     FCDParameterAnimatableVector3& GetAngularVelocity() { return angularVelocity; }
    00092     const FCDParameterAnimatableVector3& GetAngularVelocity() const { return angularVelocity; }
    00096     inline void SetAngularVelocity(const FMVector3& _angularVelocity) { angularVelocity = _angularVelocity; SetDirtyFlag(); }
    00097
    00100     FCDParameterAnimatableVector3& GetVelocity() { return velocity; }
    00101     const FCDParameterAnimatableVector3& GetVelocity() const { return velocity; }
    00105     inline void SetVelocity(const FMVector3& _velocity) { velocity = _velocity; SetDirtyFlag(); }
    00106
    00109     FCDSceneNode* GetTargetNode() { return targetNode; }
    00110     const FCDSceneNode* GetTargetNode() const { return targetNode; }
    00114     void SetTargetNode(FCDSceneNode* target) { targetNode = target; SetDirtyFlag(); }
    00115
    00122     CollisionEvent& GetCollisionEvent() { return *onCollisionEvent; }
    00123
    00129     virtual FCDEntityInstance* Clone(FCDEntityInstance* clone = NULL) const;
    00130
    00134     void SetRigidBody(FCDPhysicsRigidBody* body);
    00135 };
    00136
    00137 #endif // _FCD_PHYSICS_RIGID_BODY_ENTITY_H_