Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
t3du authored Dec 20, 2024
1 parent e084bef commit 71f41f3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions armory/Sources/armory/logicnode/DistanceScreenToWorldSpaceNode.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package armory.logicnode;

import iron.math.Vec4;
import iron.math.RayCaster;

class DistanceScreenToWorldSpaceNode extends LogicNode {

public function new(tree: LogicTree) {
super(tree);
}

override function get(from: Int): Dynamic {
var vInput: Vec4 = new Vec4();
vInput.x = inputs[0].get();
vInput.y = inputs[1].get();

var cam = iron.Scene.active.camera;
if (cam == null) return null;

return (inputs[2].get().y) - cam.transform.world.getLoc().y / RayCaster.getRay(vInput.x, vInput.y, cam).direction.y;
//return RayCaster.getRay(vInput.x, vInput.y, cam).distanceToPoint(inputs[2].get());

}
}

0 comments on commit 71f41f3

Please sign in to comment.