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.
This commit is contained in:
Sybren A. Stüvel 2015-03-04 13:21:38 +01:00
parent 6efcd9e8fe
commit ffee7f1a58
Notes: blender-bot 2023-02-14 06:55:40 +01:00
Referenced by commit d21018b334, Fix T44065: fixed vehicle constraint
1 changed files with 3 additions and 1 deletions

View File

@ -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);