From 255cef83fb82e2c41e12b1cd0e62425f102385dc Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Thu, 3 Apr 2014 16:16:53 -0700 Subject: [PATCH] Fixed #738. --- app/lib/world/thang.coffee | 2 +- app/lib/world/thang_state.coffee | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/lib/world/thang.coffee b/app/lib/world/thang.coffee index 41544cbca..426e7541f 100644 --- a/app/lib/world/thang.coffee +++ b/app/lib/world/thang.coffee @@ -38,7 +38,7 @@ module.exports = class Thang publishNote: (channel, event) -> event.thang = @ @world.publishNote channel, event - + setGoalState: (goalID, status) -> @world.setGoalState goalID, status diff --git a/app/lib/world/thang_state.coffee b/app/lib/world/thang_state.coffee index 7ea6a9687..655f41b01 100644 --- a/app/lib/world/thang_state.coffee +++ b/app/lib/world/thang_state.coffee @@ -98,10 +98,14 @@ module.exports = class ThangState storage = @trackedPropertyValues[propIndex] value = @getStoredProp propIndex, type, storage if prop is "pos" - @thang.pos = @thang.pos.copy() - @thang.pos.x = inverse * @thang.pos.x + ratio * value.x - @thang.pos.y = inverse * @thang.pos.y + ratio * value.y - @thang.pos.z = inverse * @thang.pos.z + ratio * value.z + if @thang.pos.distanceSquared(value) > 900 + # Don't interpolate; it was probably a teleport. https://github.com/codecombat/codecombat/issues/738 + @thang.pos = value + else + @thang.pos = @thang.pos.copy() + @thang.pos.x = inverse * @thang.pos.x + ratio * value.x + @thang.pos.y = inverse * @thang.pos.y + ratio * value.y + @thang.pos.z = inverse * @thang.pos.z + ratio * value.z else if prop is "rotation" @thang.rotation = inverse * @thang.rotation + ratio * value @thang.partialState = true