Merge pull request #547 from kevinresol/patch-1

[NavAgent] Expose speed prop
This commit is contained in:
Lubos Lenco 2018-03-07 11:18:48 +01:00 committed by GitHub
commit 32ce997de0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,9 @@ import iron.system.Tween;
class NavAgent extends Trait {
@prop
var speed:Float = 0.2;
var path:Array<Vec4> = null;
var index = 0;
@ -42,7 +45,6 @@ class NavAgent extends Trait {
var p = path[index];
var dist = Vec4.distance(object.transform.loc, p);
var speed = 0.2;
orient.subvecs(p, object.transform.loc).normalize;
var targetAngle = Math.atan2(orient.y, orient.x) + Math.PI / 2;