fix an exception where hitPointWorld gets null.

...due to too short Rays set by the user.
Suggestion for the fix by zicklag, see here: http://forums.armory3d.org/t/bullet-physics-keeps-freezing-the-games/2925/2
Can confirm its working now.
This commit is contained in:
rbx775 2019-04-01 11:42:48 +02:00 committed by GitHub
parent 34794bf46b
commit fab8795e8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,12 +25,16 @@ class CastPhysicsRayNode extends LogicNode {
}
else if (from == 1) { // Hit
var hitPointWorld:Vec4 = rb != null ? physics.hitPointWorld : null;
v.set(hitPointWorld.x, hitPointWorld.y, hitPointWorld.z, 1);
return v;
if (hitPointWorld != null) {
v.set(hitPointWorld.x, hitPointWorld.y, hitPointWorld.z, 1);
return v;
}
} else { // Normal
var hitNormalWorld:Vec4 = rb != null ? physics.hitNormalWorld : null;
v.set(hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z, 0);
return v;
if (hitNormalWorld != null) {
v.set(hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z, 0);
return v;
}
}
#end
return null;