This commit is contained in:
Nick Winter 2014-03-28 15:23:12 -07:00
parent 05fed5f79b
commit cf81d51a89
2 changed files with 9 additions and 11 deletions

View file

@ -287,7 +287,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
rotationType = @thangType.get('rotationType')
return if rotationType is 'fixed'
rotation = @getRotation()
if @thang.maximizesArc and @thangType.get('name') in ['Arrow', 'Spear']
if @thangType.get('name') in ['Arrow', 'Spear']
# Rotates the arrow to see it arc based on velocity.z.
# At midair we must see the original angle (delta = 0), but at launch time
# and arrow must point upwards/downwards respectively.
@ -296,15 +296,13 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
# higher speed -> higher steep (0 at midpoint).
# All constants are empirical. Notice that rotation here does not affect thang's state - it is just the effect.
# Thang's rotation is always pointing where it is heading.
velocity = @thang.velocity.z
factor = rotation
factor = -factor if factor < 0
flip = 1
if factor > 90
factor = 180 - factor
flip = -1 # when the arrow is on the left, 'up' means subtracting
factor = Math.max(factor / 90, 0.4) # between 0.4 and 1.0
rotation += flip * (velocity / 12) * factor * 45 # theoretically, 45 is the maximal delta we can make here
vz = @thang.velocity.z
if vz and speed = @thang.velocity.magnitude(true)
vx = @thang.velocity.x
heading = @thang.velocity.heading()
xFactor = Math.cos heading
zFactor = vz / Math.sqrt(vz * vz + vx * vx)
rotation -= xFactor * zFactor * 45
imageObject ?= @imageObject
return imageObject.rotation = rotation if not rotationType
@updateIsometricRotation(rotation, imageObject)

View file

@ -150,7 +150,7 @@ module.exports = class HUDView extends View
createActions: ->
actions = @$el.find('.thang-actions tbody').empty()
showActions = @thang.world and not _.isEmpty(@thang.actions) and 'action' in @thang.hudProperties ? []
showActions = @thang.world and not @thang.notOfThisWorld and not _.isEmpty(@thang.actions) and 'action' in (@thang.hudProperties ? [])
@$el.find('.thang-actions').toggleClass 'secret', not showActions
return unless showActions
@buildActionTimespans()