Update leenkx/Sources/leenkx/logicnode/HasContactNode.hx

This commit is contained in:
2025-10-03 07:55:46 +00:00
parent 2ddc938db8
commit f2c4be6336

View File

@ -1,7 +1,10 @@
package leenkx.logicnode;
import iron.object.Object;
#if lnx_physics
import leenkx.trait.physics.PhysicsCache;
import leenkx.trait.physics.RigidBody;
#end
class HasContactNode extends LogicNode {
@ -15,15 +18,15 @@ class HasContactNode extends LogicNode {
if (object1 == null || object2 == null) return false;
#if lnx_physics
var rb1 = leenkx.trait.physics.PhysicsCache.getCachedRigidBody(object1);
var rb2 = leenkx.trait.physics.PhysicsCache.getCachedRigidBody(object2);
#if lnx_physics
var rb1 = PhysicsCache.getCachedRigidBody(object1);
var rb2 = PhysicsCache.getCachedRigidBody(object2);
if (rb1 != null && rb2 != null) {
var rbs = leenkx.trait.physics.PhysicsCache.getCachedContacts(rb1);
return leenkx.trait.physics.PhysicsCache.hasContactWith(rbs, rb2);
var rbs = PhysicsCache.getCachedContacts(rb1);
return PhysicsCache.hasContactWith(rbs, rb2);
}
#end
#end
return false;
}
}