Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2015-03-04 15:21:38 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2015-03-04 16:15:41 +0300
commitffee7f1a58a18bc08add94176ddffe29809139a6 (patch)
treeb7659a32a925dc5d9524be5f341f08c792c31d89
parent6efcd9e8fec28aecc23ae7560d07ad19f5aeb57b (diff)
BGE: Fix crash when a constraint misses its reference object
Blender allows you to create a constraint without specifying its reference object, even when the constraint requires such a reference. The BGE would crash on this. This change simply ignores such a constraint.
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 557b52978ef..ac74029fbe3 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -2644,7 +2644,9 @@ int CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl
if (!rb0)
return 0;
-
+ // If either of the controllers is missing, we can't do anything.
+ if (!c0 || !c1) return 0;
+
btVector3 pivotInB = rb1 ? rb1->getCenterOfMassTransform().inverse()(rb0->getCenterOfMassTransform()(pivotInA)) :
rb0->getCenterOfMassTransform() * pivotInA;
btVector3 axisInA(axisX,axisY,axisZ);