- Timestamp:
- Dec 13, 2008, 4:14:36 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.h
r2407 r2423 35 35 #define OGRE_FORCE_ANGLE_TYPES 36 36 #include <OgreSceneNode.h> 37 38 37 #include "LinearMath/btMotionState.h" 39 38 … … 126 125 127 126 void attach(WorldEntity* object); 128 // void attachAsdf(BlinkingBillboard* object);129 127 void detach(WorldEntity* object); 130 128 WorldEntity* getAttachedObject(unsigned int index) const; 131 // BlinkingBillboard* getAttachedAsdfObject(unsigned int index) const;132 129 inline const std::set<WorldEntity*>& getAttachedObjects() const 133 130 { return this->children_; } … … 146 143 inline WorldEntity* getParent() const 147 144 { return this->parent_; } 145 146 void notifyChildPropsChanged(); 148 147 149 148 protected: … … 185 184 }; 186 185 187 bool hasPhysics() const { return getCollisionType() != None ; } 188 bool isStatic() const { return getCollisionType() == Static ; } 189 bool isKinematic() const { return getCollisionType() == Kinematic; } 190 bool isDynamic() const { return getCollisionType() == Dynamic ; } 191 bool isPhysicsRunning() const; 186 bool hasPhysics() const { return getCollisionType() != None ; } 187 bool isStatic() const { return getCollisionType() == Static ; } 188 bool isKinematic() const { return getCollisionType() == Kinematic; } 189 bool isDynamic() const { return getCollisionType() == Dynamic ; } 190 bool isPhysicsActive() const { return this->bPhysicsActive_; } 191 bool addedToPhysicalWorld() const; 192 193 void activatePhysics(); 194 void deactivatePhysics(); 192 195 193 196 inline CollisionType getCollisionType() const … … 201 204 inline float getMass() const 202 205 { return this->mass_; } 203 204 void attachCollisionShape(CollisionShape* shape, bool bWorldEntityRoot = false); 206 inline float getTotalMass() const 207 { return this->mass_ + this->childrenMass_; } 208 209 void attachCollisionShape(CollisionShape* shape); 210 void detachCollisionShape(CollisionShape* shape); 205 211 CollisionShape* getAttachedCollisionShape(unsigned int index) const; 206 212 … … 210 216 { return this->physicalBody_; } 211 217 218 void notifyCollisionShapeChanged(); 219 void notifyChildMassChanged(); 220 212 221 protected: 213 222 virtual bool isCollisionTypeLegal(CollisionType type) const = 0; … … 217 226 private: 218 227 void updateCollisionType(); 219 void mergeCollisionShape(CollisionShape* shape); 220 void internalSetMassProps(); 221 btVector3 getLocalInertia(btScalar mass) const; 222 bool checkPhysics() const; 223 void addToPhysicalWorld() const; 224 void removeFromPhysicalWorld() const; 228 void recalculatePhysicsProps(); 225 229 226 230 // network callbacks 227 231 void collisionTypeChanged(); 228 232 void massChanged(); 233 void physicsActivityChanged(); 229 234 230 235 CollisionType collisionType_; 231 236 CollisionType collisionTypeSynchronised_; 237 bool bPhysicsActive_; 238 bool bPhysicsActiveSynchronised_; 232 239 CompoundCollisionShape* collisionShape_; 233 240 btScalar mass_; 234 btScalar child Mass_;241 btScalar childrenMass_; 235 242 }; 236 243 }
Note: See TracChangeset
for help on using the changeset viewer.