     Date.now() - @kickTime
 
   setState:(state)->
+    @sprite.rotation = 0 if isNaN(@sprite.rotation)
     if !@spawned
       @sprite.position.x = state.x
       @sprite.position.y = state.y

    @angular = state.angular
    @angle = state.angle
    if @sprite.body?
      @sprite.rotation = 0 if _.isNaN?(@sprite.rotation)
      @sprite.animations.play(@anim)
      @sprite.body.angularVelocity = @angular
      if @angular == 0
        @sprite.angle = @angle

  getState:->
    if @sprite.body?
      @sprite.rotation = 0 if _.isNaN?(@sprite.rotation)
      @sprite.animations.play(@anim)
      @sprite.body.angularVelocity = @angular
      if @angular == 0

    @game.physics.arcade.enable(@sprite)
    if !@isRemote
      @onGainOwnership()
    @sprite.rotation = 0 if isNaN(@sprite.rotation)

  onLoseOwnership:->
    @sprite.rotation = 0 if isNaN(@sprite.rotation)
    @sprite.body.drag.set(0, 0)
    @sprite.body.collideWorldBounds = false
    @sprite.body.bounce.set(0, 0)

  onGainOwnership:->
    @sprite.rotation = 0 if isNaN(@sprite.rotation)
    @sprite.body.drag.set(DRAG, DRAG)
    @sprite.body.collideWorldBounds = true
    @sprite.body.bounce.set(0.9, 0.9)
