fix: no direction set for zero vector

This commit is contained in:
cha0s 2019-05-09 15:15:51 -05:00
parent f15b23c437
commit 414a1eb5a0

View File

@ -37,6 +37,9 @@ export class Directional extends decorate(Trait) {
const listeners = {}; const listeners = {};
if (this.params.trackMovement) { if (this.params.trackMovement) {
listeners.movementRequest = (vector) => { listeners.movementRequest = (vector) => {
if (Vector.isZero(vector)) {
return;
}
this.entity.direction = Vector.toDirection(vector, this.directionCount); this.entity.direction = Vector.toDirection(vector, this.directionCount);
}; };
} }