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:
parent
34794bf46b
commit
fab8795e8e
|
@ -25,12 +25,16 @@ class CastPhysicsRayNode extends LogicNode {
|
||||||
}
|
}
|
||||||
else if (from == 1) { // Hit
|
else if (from == 1) { // Hit
|
||||||
var hitPointWorld:Vec4 = rb != null ? physics.hitPointWorld : null;
|
var hitPointWorld:Vec4 = rb != null ? physics.hitPointWorld : null;
|
||||||
v.set(hitPointWorld.x, hitPointWorld.y, hitPointWorld.z, 1);
|
if (hitPointWorld != null) {
|
||||||
return v;
|
v.set(hitPointWorld.x, hitPointWorld.y, hitPointWorld.z, 1);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
} else { // Normal
|
} else { // Normal
|
||||||
var hitNormalWorld:Vec4 = rb != null ? physics.hitNormalWorld : null;
|
var hitNormalWorld:Vec4 = rb != null ? physics.hitNormalWorld : null;
|
||||||
v.set(hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z, 0);
|
if (hitNormalWorld != null) {
|
||||||
return v;
|
v.set(hitNormalWorld.x, hitNormalWorld.y, hitNormalWorld.z, 0);
|
||||||
|
return v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue