Merge pull request #551 from kevinresol/patch-3

NavAgent: faster is faster
This commit is contained in:
Lubos Lenco 2018-03-08 14:11:02 +01:00 committed by GitHub
commit 798cdc01e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,7 @@ import iron.system.Tween;
class NavAgent extends Trait {
@prop
var speed:Float = 0.2;
var speed:Float = 5;
var path:Array<Vec4> = null;
var index = 0;
@ -49,7 +49,7 @@ class NavAgent extends Trait {
orient.subvecs(p, object.transform.loc).normalize;
var targetAngle = Math.atan2(orient.y, orient.x) + Math.PI / 2;
locAnim = Tween.to({ target: object.transform.loc, props: { x: p.x, y: p.y /*, z: p.z*/ }, duration: dist * speed, done: function() {
locAnim = Tween.to({ target: object.transform.loc, props: { x: p.x, y: p.y /*, z: p.z*/ }, duration: dist / speed, done: function() {
index++;
if (index < path.length) go();
else removeUpdate(update);