Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package leenkx.logicnode;
import iron.math.Vec4;
class PickObjectNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function get(from: Int): Dynamic {
var coords: Vec4 = inputs[0].get();
var mask: Int = inputs[1].get();
if (coords == null) return null;
#if lnx_physics
var physics = leenkx.trait.physics.PhysicsWorld.active;
var rb = physics.pickClosest(coords.x, coords.y, mask);
if (rb == null) return null;
if (from == 0) { // Object
return rb.object;
}
else if(from == 1){ // Hit
var v = new Vec4();
return v.set(physics.hitPointWorld.x, physics.hitPointWorld.y, physics.hitPointWorld.z);
}
else { // Normal
var v = new Vec4();
return v.set(physics.hitNormalWorld.x, physics.hitNormalWorld.y, physics.hitNormalWorld.z, 0);
}
#end
return null;
}
}