Merge pull request #1242 from rbx775/master

fix an exception where hitPointWorld gets null.
This commit is contained in:
Lubos Lenco 2019-04-01 11:47:00 +02:00 committed by GitHub
commit 2245cb363e
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;