2017-04-03 22:29:46 +02:00
|
|
|
package armory.logicnode;
|
|
|
|
|
2017-11-20 15:16:52 +01:00
|
|
|
import iron.math.Vec4;
|
2017-09-30 00:32:06 +02:00
|
|
|
import armory.trait.navigation.Navigation;
|
2017-04-03 22:29:46 +02:00
|
|
|
|
2017-04-08 20:05:35 +02:00
|
|
|
class NavigableLocationNode extends LogicNode {
|
2017-04-03 22:29:46 +02:00
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
var loc: Vec4;
|
2017-04-03 22:29:46 +02:00
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
public function new(tree: LogicTree) {
|
2017-04-04 23:11:31 +02:00
|
|
|
super(tree);
|
2017-04-03 22:29:46 +02:00
|
|
|
|
2017-11-20 15:16:52 +01:00
|
|
|
iron.Scene.active.notifyOnInit(function() {
|
2017-04-08 20:05:35 +02:00
|
|
|
get(0);
|
2017-04-03 22:29:46 +02:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-12-19 23:54:08 +01:00
|
|
|
override function get(from: Int): Dynamic {
|
2017-04-03 22:29:46 +02:00
|
|
|
#if arm_navigation
|
|
|
|
// Assume navmesh exists..
|
2019-12-19 23:54:08 +01:00
|
|
|
Navigation.active.navMeshes[0].getRandomPoint(function(p: Vec4) {
|
2017-04-03 22:29:46 +02:00
|
|
|
loc = p;
|
|
|
|
});
|
|
|
|
#end
|
|
|
|
return loc;
|
|
|
|
}
|
|
|
|
}
|