Changeset 1764 for trunk/test/Physics/Include
- Timestamp:
- Aug 16, 2012, 7:14:07 PM (10 years ago)
- Location:
- trunk/test/Physics/Include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Physics/Include/EasyCharacterController.h
r1749 r1764 36 36 37 37 public: 38 EasyCharacterController( ) :39 EasyPhysic( ),38 EasyCharacterController(WorldEntity* NewOwnerEntity) : 39 EasyPhysic(NewOwnerEntity), 40 40 m_character(NULL) 41 41 { -
trunk/test/Physics/Include/EasyPhysics.h
r1749 r1764 39 39 40 40 public: 41 EasyPhysic( );41 EasyPhysic(WorldEntity* NewOwnerEntity); 42 42 ~EasyPhysic(); 43 43 … … 50 50 virtual bool CanChangeCollisionChannel() { return (m_rigid_body == NULL); } 51 51 virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))); 52 private: 53 virtual void BaseTransformChanged(const lol::mat4& PreviousMatrix, const lol::mat4& NewMatrix); 54 public: 52 55 virtual void SetMass(float mass); 53 56 virtual void InitBodyToRigid(bool ZeroMassIsKinematic=false); … … 77 80 78 81 public: 79 EasyPhysic( ) {}82 EasyPhysic(WorldEntity* NewOwnerEntity) { m_owner_entity = NewOwnerEntity; } 80 83 81 84 virtual void SetShapeToBox(lol::vec3& BoxSize) { } … … 87 90 virtual bool CanChangeCollisionChannel() { return true; } 88 91 virtual void SetTransform(const lol::vec3& base_location, const lol::quat& base_rotation=lol::quat(lol::mat4(1.0f))) { } 92 private: 93 virtual void BaseTransformChanged(const lol::mat4& PreviousMatrix, const lol::mat4& NewMatrix) { } 94 public: 89 95 virtual void SetMass(float mass) { } 90 96 virtual void InitBodyToRigid() { } … … 114 120 int GetCollisionMask() { return m_collision_mask; } 115 121 122 //Base/Attachment logic 123 virtual void AttachTo(EasyPhysic* NewBase, bool NewBaseLockLocation = true, bool NewBaseLockRotation = true) 124 { 125 if (NewBase == this || NewBase->m_base_physic == this) 126 return; 127 128 if (NewBase) 129 { 130 bool bAlreadyExists = false; 131 for (int i = 0; i < NewBase->m_based_physic_list.Count(); ++i) 132 if (NewBase->m_based_physic_list[i] == this) 133 bAlreadyExists = true; 134 if (!bAlreadyExists) 135 NewBase->m_based_physic_list << this; 136 m_base_physic = NewBase; 137 m_base_lock_location = NewBaseLockLocation; 138 m_base_lock_rotation = NewBaseLockRotation; 139 } 140 else 141 { 142 for (int i = 0; i < NewBase->m_based_physic_list.Count(); ++i) 143 if (NewBase->m_based_physic_list[i] == this) 144 NewBase->m_based_physic_list.Remove(i--); 145 m_base_physic = NULL; 146 } 147 } 148 116 149 protected: 117 150 lol::mat4 m_local_to_world; … … 119 152 int m_collision_group; 120 153 int m_collision_mask; 154 WorldEntity* m_owner_entity; 155 156 //Base/Attachment logic 157 Array<EasyPhysic*> m_based_physic_list; //List of objects based on this : this object moves, its based object move with it. 158 EasyPhysic* m_base_physic; //Base for this object : The base moves, the object moves with it. 159 bool m_base_lock_location; //when this is TRUE, location moves with rotation change. 160 bool m_base_lock_rotation; //when this is TRUE, rotation moves with rotation change. 161 162 //Touch logic 163 Array<EasyPhysic*> m_touching_physic; //Maintained by ghost objects 121 164 }; 122 165
Note: See TracChangeset
for help on using the changeset viewer.