Browse Source

Added warning for creating any of the physics components into the root scene node, as that is unsupported and may not eg. reload properly.

Lasse Öörni 13 years ago
parent
commit
aa1c2b8605

+ 3 - 0
Engine/Physics/CollisionShape.cpp

@@ -630,6 +630,9 @@ void CollisionShape::OnNodeSet(Node* node)
         Scene* scene = GetScene();
         if (scene)
         {
+            if (scene == node)
+                LOGWARNING(GetTypeName() + " should not be created to the root scene node");
+            
             physicsWorld_ = scene->GetComponent<PhysicsWorld>();
             if (physicsWorld_)
                 physicsWorld_->AddCollisionShape(this);

+ 3 - 0
Engine/Physics/Constraint.cpp

@@ -358,6 +358,9 @@ void Constraint::OnNodeSet(Node* node)
         Scene* scene = GetScene();
         if (scene)
         {
+            if (scene == node)
+                LOGWARNING(GetTypeName() + " should not be created to the root scene node");
+            
             physicsWorld_ = scene->GetComponent<PhysicsWorld>();
             if (physicsWorld_)
                 physicsWorld_->AddConstraint(this);

+ 3 - 0
Engine/Physics/RigidBody.cpp

@@ -775,6 +775,9 @@ void RigidBody::OnNodeSet(Node* node)
         Scene* scene = GetScene();
         if (scene)
         {
+            if (scene == node)
+                LOGWARNING(GetTypeName() + " should not be created to the root scene node");
+            
             physicsWorld_ = scene->GetComponent<PhysicsWorld>();
             if (physicsWorld_)
                 physicsWorld_->AddRigidBody(this);