This commit is contained in:
2026-05-06 17:52:45 -07:00
parent 9fc3f35125
commit 1463c23334
402 changed files with 3758 additions and 0 deletions

View File

@ -0,0 +1,26 @@
package lnx;
import iron.system.Input;
import leenkx.trait.physics.PhysicsWorld;
class PickTrait extends iron.Trait {
public function new() {
super();
notifyOnUpdate(function() {
// Check mouse button
var mouse = Input.getMouse();
if (!mouse.started()) return;
// Pick object at mouse coords
var rb = PhysicsWorld.active.pickClosest(mouse.x, mouse.y);
// Check if picked object is our Cube
if (rb != null && rb.object.name == 'Cube') {
rb.object.transform.translate(0, 0, 1);
rb.syncTransform();
}
});
}
}