Changeset 8422 for code/branches/pickup/src/orxonox
- Timestamp:
- May 8, 2011, 11:45:32 PM (14 years ago)
- Location:
- code/branches/pickup/src/orxonox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.cc
r7401 r8422 26 26 * 27 27 */ 28 29 /** 30 @file CollisionShape.cc 31 @brief Implementation of the CollisionShape class. 32 */ 28 33 29 34 #include "CollisionShape.h" … … 39 44 namespace orxonox 40 45 { 46 47 /** 48 @brief 49 Constructor. Registers and initializes the object. 50 */ 41 51 CollisionShape::CollisionShape(BaseObject* creator) 42 52 : BaseObject(creator) … … 51 61 this->orientation_ = Quaternion::IDENTITY; 52 62 this->scale_ = Vector3::UNIT_SCALE; 63 this->uniformScale_ = true; 53 64 54 65 this->registerVariables(); 55 66 } 56 67 68 /** 69 @brief 70 Destructor. Detaches the CollisionShape from its parent. 71 */ 57 72 CollisionShape::~CollisionShape() 58 73 { 59 // Detach from parent 74 // Detach from parent CompoundCollisionShape. 60 75 if (this->isInitialized() && this->parent_) 61 76 this->parent_->detach(this); … … 75 90 } 76 91 92 /** 93 @brief 94 Register variables that need synchronizing over the network. 95 */ 77 96 void CollisionShape::registerVariables() 78 97 { 98 // Keep the shape's parent (can be either a CompoundCollisionShape or a WorldEntity) consistent over the network. 79 99 registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged)); 80 100 } 81 101 102 /** 103 @brief 104 Notifies the CollisionShape of being attached to a CompoundCollisionShape. 105 @param newParent 106 A pointer to the CompoundCollisionShape the CollisionShape was attached to. 107 @return 108 Returns 109 */ 110 bool CollisionShape::notifyBeingAttached(CompoundCollisionShape* newParent) 111 { 112 // If the CollisionShape is attached to a CompoundCollisionShapes, detach it. 113 if (this->parent_) 114 this->parent_->detach(this); 115 116 this->parent_ = newParent; 117 118 // If the new parent is a WorldEntityCollisionShape, the parentID is set to the objectID of the WorldEntity that is its owner. 119 // TODO: Why? 120 WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent); 121 if (parentWECCS) 122 this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID(); 123 // Else it is set to the objectID of the CompoundCollisionShape. 124 else 125 this->parentID_ = newParent->getObjectID(); 126 127 return true; 128 } 129 130 /** 131 @brief 132 Notifies the CollisionShape of being detached from a CompoundCollisionShape. 133 */ 134 void CollisionShape::notifyDetached() 135 { 136 this->parent_ = 0; 137 this->parentID_ = OBJECTID_UNKNOWN; 138 } 139 140 /** 141 @brief 142 Updates the CompoundCollisionShape the CollisionShape belongs to (if it belongs to one), after the CollisionShape has changed. 143 */ 144 void CollisionShape::updateParent() 145 { 146 if (this->parent_) 147 this->parent_->updateAttachedShape(this); 148 } 149 150 /** 151 @brief 152 Is called when the parentID of the CollisionShape has changed. 153 Attaches it to the object with the changed parentID, which can either be a CompoundCollisionShape or a WorldEntity. 154 */ 82 155 void CollisionShape::parentChanged() 83 156 { 157 // Get the parent object from the network. 84 158 Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_); 159 85 160 // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the 86 161 // internal collision shape (which is compound) of a WE doesn't get synchronised. 87 162 CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent); 163 164 // If the parent is a CompoundCollisionShape, attach the CollisionShape to it. 88 165 if (parentCCS) 89 166 parentCCS->attach(this); 90 167 else 91 168 { 169 // If the parent is a WorldEntity, attach the CollisionShape to its collision shapes. 92 170 WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent); 93 171 if (parentWE) … … 96 174 } 97 175 98 bool CollisionShape::notifyBeingAttached(CompoundCollisionShape* newParent) 99 { 100 if (this->parent_) 101 this->parent_->detach(this); 102 103 this->parent_ = newParent; 104 105 WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent); 106 if (parentWECCS) 107 this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID(); 108 else 109 this->parentID_ = newParent->getObjectID(); 110 111 return true; 112 } 113 114 void CollisionShape::notifyDetached() 115 { 116 this->parent_ = 0; 117 this->parentID_ = OBJECTID_UNKNOWN; 118 } 119 120 void CollisionShape::updateParent() 121 { 122 if (this->parent_) 123 this->parent_->updateAttachedShape(this); 124 } 125 176 /** 177 @brief 178 Check whether the CollisionShape has been either moved or rotated or both. (i.e. it doesn't have position zero and identity orientation any more) 179 @return 180 Returns true if it has been moved. 181 */ 126 182 bool CollisionShape::hasTransform() const 127 183 { … … 130 186 } 131 187 188 /** 189 @brief 190 Set the scale of the CollisionShape. 191 Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions. 192 If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 193 Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes. 194 @param scale 195 The new scale to be set. Vector3::UNIT_SCALE is the initial scale. 196 */ 132 197 void CollisionShape::setScale3D(const Vector3& scale) 133 198 { 134 CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl; 135 } 136 199 if(this->scale_ == scale) 200 return; 201 202 // If the vectors are not in the same direction, then this is no longer a uniform scaling. 203 if(scale_.crossProduct(scale).squaredLength() != 0.0f) 204 { 205 CCOUT(2) << "Warning: Non-uniform scaling is not yet supported." << endl; 206 return; 207 } 208 209 this->scale_ = scale; 210 211 this->changedScale(); 212 this->updateParent(); 213 } 214 215 /** 216 @brief 217 Set the (uniform) scale of the CollisionShape. 218 If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 219 @param scale 220 The scale to scale the CollisionShape with. 1.0f is the initial scale. 221 */ 137 222 void CollisionShape::setScale(float scale) 138 223 { 139 CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl; 140 } 141 224 if(this->scale_.length() == scale) 225 return; 226 227 this->scale_ = Vector3::UNIT_SCALE*scale; 228 229 this->changedScale(); 230 this->updateParent(); 231 } 232 233 /** 234 @brief 235 Is called when the scale of the CollisionShape has changed. 236 */ 237 void CollisionShape::changedScale() 238 { 239 // Adjust the position of the CollisionShape. 240 this->position_ *= this->getScale3D(); 241 } 242 243 /** 244 @brief 245 Updates the shape. 246 Is called when the internal parameters of the shape have changed such that a new shape needs to be created. 247 */ 142 248 void CollisionShape::updateShape() 143 249 { 144 250 btCollisionShape* oldShape = this->collisionShape_; 145 251 this->collisionShape_ = this->createNewShape(); 252 // If the CollisionShape has been rescaled, scale the shape to fit the current scale. 253 if(this->scale_ != Vector3::UNIT_SCALE) 254 this->changedScale(); 146 255 // When we recreate the shape, we have to inform the parent about this to update the shape 147 256 this->updateParent(); … … 150 259 } 151 260 261 /** 262 @brief 263 Calculates the local inertia of the collision shape. 264 @todo 265 Document. 266 */ 152 267 void CollisionShape::calculateLocalInertia(float mass, btVector3& inertia) const 153 268 { -
code/branches/pickup/src/orxonox/collisionshapes/CollisionShape.h
r7163 r8422 27 27 */ 28 28 29 /** 30 @file CollisionShape.h 31 @brief Definition of the CollisionShape class. 32 @ingroup Collisionshapes 33 */ 34 29 35 #ifndef _CollisionShape_H__ 30 36 #define _CollisionShape_H__ … … 38 44 namespace orxonox 39 45 { 46 47 /** 48 @brief 49 Wrapper for bullet collision shape class btCollisionShape. 50 51 @author 52 Reto Grieder 53 54 @see btCollisionShape 55 @ingroup Collisionshapes 56 */ 40 57 class _OrxonoxExport CollisionShape : public BaseObject, public Synchronisable 41 58 { … … 46 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 47 64 65 /** 66 @brief Set the position of the CollisionShape. 67 If the position changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 68 @param position A vector indicating the new position. 69 */ 48 70 inline void setPosition(const Vector3& position) 49 { this->position_ = position; this->updateParent(); } 71 { if(this->position_ == position) return; this->position_ = position; this->updateParent(); } 72 /** 73 @brief Get the position of the CollisionShape. 74 @return Returns the position of the CollisionShape as a vector. 75 */ 50 76 inline const Vector3& getPosition() const 51 77 { return this->position_; } 52 78 79 /** 80 @brief Set the orientation of the CollisionShape. 81 If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 82 @param orientation A quaternion indicating the new orientation. 83 */ 53 84 inline void setOrientation(const Quaternion& orientation) 54 { this->orientation_ = orientation; this->updateParent(); } 85 { if(this->orientation_ == orientation) return; this->orientation_ = orientation; this->updateParent(); } 86 /** 87 @brief Get the orientation of the CollisionShape. 88 @return Returns the orientation of the CollisionShape as a quaternion. 89 */ 55 90 inline const Quaternion& getOrientation() const 56 91 { return this->orientation_; } 57 92 58 void yaw(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); } 59 void pitch(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); } 60 void roll(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); } 93 /** 94 @brief Rotate the CollisionShape around the y-axis by the specified angle. 95 If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 96 @param angle The angle by which the CollisionShape is rotated. 97 */ 98 void yaw(const Degree& angle) 99 { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); } 100 /** 101 @brief Rotate the CollisionShape around the x-axis by the specified angle. 102 If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 103 @param angle The angle by which the CollisionShape is rotated. 104 */ 105 void pitch(const Degree& angle) 106 { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); } 107 /** 108 @brief Rotate the CollisionShape around the z-axis by the specified angle. 109 If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 110 @param angle The angle by which the CollisionShape is rotated. 111 */ 112 void roll(const Degree& angle) 113 { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); } 61 114 62 virtual void setScale3D(const Vector3& scale); 63 virtual void setScale(float scale); 115 /** 116 @brief Scale the CollisionShape by the input vector. 117 Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions. 118 If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 119 Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes. 120 @param scale The scaling vector by which the CollisionShape is scaled. 121 */ 122 inline void scale3D(const Vector3& scale) 123 { this->setScale3D(this->getScale3D()*scale); } 124 void setScale3D(const Vector3& scale); // Set the scale of the CollisionShape. 125 /** 126 @brief Get the scale of the CollisionShape. 127 @return Returns a vector indicating the scale of the CollisionShape. 128 */ 64 129 inline const Vector3& getScale3D() const 65 130 { return this->scale_; } 66 131 67 void updateShape(); 132 /** 133 @brief (Uniformly) scale the CollisionShape by the input scale. 134 If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated. 135 @param scale The value by which the CollisionShape is scaled. 136 */ 137 inline void scale(float scale) 138 { this->setScale3D(this->getScale3D()*scale); } 139 void setScale(float scale); // Set the (uniform) scale of the CollisionShape. 140 /** 141 @brief Get the (uniform) scale of the CollisionShape. 142 This is only meaningful if the CollisionShape has uniform scaling. 143 @return Returns the (uniform) scale of the CollisionShape. Returns 0.0f if the scaling is non-uniform. 144 */ 145 inline float getScale() 146 { if(this->hasUniformScaling()) return this->scale_.x; return 0.0f; } 68 147 69 void calculateLocalInertia(float mass, btVector3& inertia) const; 148 /** 149 @brief Check whether the CollisionShape is uniformly scaled. 150 @return Returns true if the CollisionShape is uniformly scaled, false if not. 151 */ 152 inline bool hasUniformScaling() 153 { return this->uniformScale_; } 154 virtual void changedScale(); // Is called when the scale of the CollisionShape has changed. 70 155 156 void updateShape(); // Updates the shape. 157 158 void calculateLocalInertia(float mass, btVector3& inertia) const; // Calculates the local inertia of the collision shape. 159 160 /** 161 @brief Get the bullet collision shape of this CollisionShape. 162 @return Returns a pointer to the bullet collision shape of this CollisionShape. 163 */ 71 164 inline btCollisionShape* getCollisionShape() const 72 165 { return this->collisionShape_; } 73 166 74 bool hasTransform() const; 167 bool hasTransform() const; // Check whether the CollisionShape has been either moved or rotated or both. 75 168 76 bool notifyBeingAttached(CompoundCollisionShape* newParent); 77 void notifyDetached(); 169 bool notifyBeingAttached(CompoundCollisionShape* newParent); // Notifies the CollisionShape of being attached to a CompoundCollisionShape. 170 void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape. 78 171 79 172 protected: 80 virtual void updateParent(); 81 virtual void parentChanged(); 173 virtual void updateParent(); // Updates the CompoundCollisionShape the CollisionShape belongs to, after the CollisionShape has changed. 174 virtual void parentChanged(); // Is called when the parentID of the CollisionShape has changed. 175 176 /** 177 @brief Create a new bullet collision shape depending on the internal parameters of the specific CollisionShape. 178 @return Returns a pointer to the new bullet collision shape. 179 */ 82 180 virtual btCollisionShape* createNewShape() const = 0; 83 181 84 btCollisionShape* collisionShape_; 85 CompoundCollisionShape* parent_; 86 unsigned int parentID_; 182 btCollisionShape* collisionShape_; //!< The bullet collision shape of this CollisionShape. 183 CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, NULL if it doesn't belong to one. 184 unsigned int parentID_; //!< The objectID of the parent of this CollisionShape, which can either be a CompoundCollisionShape or a WorldEntity. 87 185 88 186 private: 89 187 void registerVariables(); 90 188 91 Vector3 position_; 92 Quaternion orientation_; 93 Vector3 scale_; 189 Vector3 position_; //!< The position of the CollisionShape. 190 Quaternion orientation_; //!< The orientation of the CollisionShape. 191 Vector3 scale_; //!< The scale of the CollisionShape. 192 bool uniformScale_; //!< Whether the scale is uniform. 94 193 }; 95 194 } -
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r5929 r8422 27 27 */ 28 28 29 /** 30 @file CompoundCollisionShape.cc 31 @brief Implementation of the CompoundCollisionShape class. 32 */ 33 29 34 #include "CompoundCollisionShape.h" 30 35 … … 39 44 CreateFactory(CompoundCollisionShape); 40 45 46 /** 47 @brief 48 Constructor. Registers and initializes the object. 49 */ 41 50 CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator) 42 51 { … … 46 55 } 47 56 57 /** 58 @brief 59 Destructor. 60 Deletes all its children. 61 */ 48 62 CompoundCollisionShape::~CompoundCollisionShape() 49 63 { … … 70 84 } 71 85 86 /** 87 @brief 88 Attach the input CollisionShape to the CompoundCollisionShape. 89 @param shape 90 A pointer to the CollisionShape that is to be attached. 91 */ 72 92 void CompoundCollisionShape::attach(CollisionShape* shape) 73 93 { 94 // If either the input shape is NULL or we try to attach the CollisionShape to itself. 74 95 if (!shape || static_cast<CollisionShape*>(this) == shape) 75 96 return; 97 76 98 if (this->attachedShapes_.find(shape) != this->attachedShapes_.end()) 77 99 { … … 80 102 } 81 103 104 // Notify the CollisionShape that it is being attached to the CompoundCollisionShape. 82 105 if (!shape->notifyBeingAttached(this)) 83 106 return; 84 107 108 // Attach it. 85 109 this->attachedShapes_[shape] = shape->getCollisionShape(); 86 110 111 // Only actually attach if we didn't pick a CompoundCollisionShape with no content. 87 112 if (shape->getCollisionShape()) 88 113 { 89 // Only actually attach if we didn't pick a CompoundCollisionShape with no content90 114 btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition())); 115 // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape. 91 116 this->compoundShape_->addChildShape(transf, shape->getCollisionShape()); 92 117 … … 95 120 } 96 121 122 /** 123 @brief 124 Detach the input CollisionShape form the CompoundCollisionShape. 125 @param shape 126 A pointer to the CollisionShape to be detached. 127 */ 97 128 void CompoundCollisionShape::detach(CollisionShape* shape) 98 129 { 130 // If the input CollisionShape is actually attached. 99 131 if (this->attachedShapes_.find(shape) != this->attachedShapes_.end()) 100 132 { 101 133 this->attachedShapes_.erase(shape); 102 134 if (shape->getCollisionShape()) 103 this->compoundShape_->removeChildShape(shape->getCollisionShape()); 135 this->compoundShape_->removeChildShape(shape->getCollisionShape()); // TODO: Apparently this is broken? 104 136 shape->notifyDetached(); 105 137 … … 110 142 } 111 143 144 /** 145 @brief 146 Detach all attached CollisionShapes. 147 */ 112 148 void CompoundCollisionShape::detachAll() 113 149 { … … 116 152 } 117 153 154 /** 155 @brief 156 Update the input CollisionShape that is attached to the CompoundCollisionShape. 157 This is called when the input shape's internal collision shape (a btCollisionShape) has changed. 158 @param shape 159 A pointer to the CollisionShape to be updated. 160 */ 118 161 void CompoundCollisionShape::updateAttachedShape(CollisionShape* shape) 119 162 { 120 163 if (!shape) 121 164 return; 165 122 166 std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.find(shape); 167 // Check whether the input shape belongs to this CompoundCollisionShape. 123 168 if (it == this->attachedShapes_.end()) 124 169 { … … 129 174 // Remove old btCollisionShape, stored in the children map 130 175 if (it->second) 131 this->compoundShape_->removeChildShape(it->second); 176 this->compoundShape_->removeChildShape(it->second); // TODO: Apparently this is broken? 177 178 // Only actually attach if we didn't pick a CompoundCollisionShape with no content 132 179 if (shape->getCollisionShape()) 133 180 { 134 // Only actually attach if we didn't pick a CompoundCollisionShape with no content135 181 btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition())); 136 182 this->compoundShape_->addChildShape(transf, shape->getCollisionShape()); … … 141 187 } 142 188 189 /** 190 @brief 191 Updates the public shape, the collision shape this CompoundCollisionShape has to the outside. 192 */ 143 193 void CompoundCollisionShape::updatePublicShape() 144 194 { 145 btCollisionShape* primitive = 0; 146 bool bPrimitive = true; 147 bool bEmpty = true; 195 btCollisionShape* primitive = 0; // The primitive shape, if there is one. 196 bool bPrimitive = true; // Whether the CompoundCollisionShape has just one non-empty CollisionShape. And that shape also has no transformation. 197 bool bEmpty = true; // Whether the CompoundCollisionShape is empty. 198 // Iterate over all CollisionShapes that belong to this CompoundCollisionShape. 148 199 for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it) 149 200 { 201 // TODO: Make sure this is correct. 150 202 if (it->second) 151 203 { 152 204 bEmpty = false; 153 if (!it->first->hasTransform() && !bPrimitive)205 if (!it->first->hasTransform() && bPrimitive) 154 206 primitive = it->second; 155 207 else 208 { 156 209 bPrimitive = false; 210 break; 211 } 157 212 } 158 213 } 214 215 // If there is no non-empty CollisionShape. 159 216 if (bEmpty) 160 217 { 218 // If there was none all along, nothing needs to be changed. 161 219 if (this->collisionShape_ == 0) 162 {163 this->collisionShape_ = 0;164 220 return; 165 }166 221 this->collisionShape_ = 0; 167 222 } 223 // If the CompoundCollisionShape is just a primitive. 224 // Only one shape to be added, no transform; return it directly. 168 225 else if (bPrimitive) 169 {170 // --> Only one shape to be added, no transform; return it directly171 226 this->collisionShape_ = primitive; 172 }227 // Make sure we use the compound shape when returning a btCollisionShape. 173 228 else 174 {175 // Make sure we use the compound shape when returning a btCollisionShape176 229 this->collisionShape_ = this->compoundShape_; 177 } 230 178 231 this->updateParent(); 179 232 } 180 233 234 /** 235 @brief 236 Get the attached CollisionShape at the given index. 237 @param index 238 The index of the desired CollisionShape. 239 @return 240 Returns a pointer to the attached CollisionShape at the given index. 241 */ 181 242 CollisionShape* CompoundCollisionShape::getAttachedShape(unsigned int index) const 182 243 { … … 190 251 return 0; 191 252 } 253 254 /** 255 @brief 256 Is called when the scale of the CompoundCollisionShape has changed. 257 Iterates over all attached CollisionShapes and scales them, then recomputes their compound shape. 258 */ 259 void CompoundCollisionShape::changedScale() 260 { 261 CollisionShape::changedScale(); 262 263 // Iterate through all attached CollisionShapes. 264 for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++) 265 { 266 // Rescale the CollisionShape. 267 it->first->setScale3D(this->getScale3D()); 268 this->updateAttachedShape(it->first); 269 } 270 271 this->updatePublicShape(); 272 } 192 273 } -
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
r5781 r8422 27 27 */ 28 28 29 /** 30 @file CompoundCollisionShape.h 31 @brief Definition of the CompoundCollisionShape class. 32 @ingroup Collisionshapes 33 */ 34 29 35 #ifndef _CompoundCollisionShape_H__ 30 36 #define _CompoundCollisionShape_H__ … … 38 44 namespace orxonox 39 45 { 46 47 /** 48 @brief 49 Wrapper for the bullet compound collision shape class btCompoundShape. 50 51 @author 52 Reto Grieder 53 54 @ingroup Collisionshapes 55 */ 40 56 class _OrxonoxExport CompoundCollisionShape : public CollisionShape 41 57 { … … 53 69 void updateAttachedShape(CollisionShape* shape); 54 70 71 virtual void changedScale(); 72 55 73 private: 56 74 void updatePublicShape(); -
code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
r7937 r8422 642 642 void WorldEntity::setScale3D(const Vector3& scale) 643 643 { 644 /* 645 HACK HACK HACK 646 if (bScalePhysics && this->hasPhysics() && scale != Vector3::UNIT_SCALE) 647 { 648 CCOUT(2) << "Warning: Cannot set the scale of a physical object: Not yet implemented. Ignoring scaling." << std::endl; 649 return; 650 } 651 HACK HACK HACK 652 */ 644 // If physics is enabled scale the attached CollisionShape. 645 if (false && this->hasPhysics() && this->collisionShape_ != NULL) 646 { 647 this->collisionShape_->setScale3D(scale); 648 } 649 653 650 this->node_->setScale(scale); 654 651
Note: See TracChangeset
for help on using the changeset viewer.