Closed inkeliz closed 4 years ago
I found the second issue. It's kinda related to longTask.speed = longTask.Value / float32(longTask.Duration.Seconds())
. The problem is that the value isn't exactly, for instance you can set to zoom-out 2, but it only zoom-out 1.99.
The fix for that is enforce to set the correct value when longTask.Duration <= time.Duration(0)
. So, the last step will zoomTo(2)
.
I'll try to make an pull-request, because I blow-up my fork. 😅
Since my workaround to fix texture, I create some
Steps []float64
, so I can use:However, the change of zoom and angle is very roughly. In way to prevent it, I make one
m.MouseZoomer.Duration = time.Second
. TheDuration
supplies theDuration
ofCameraMessage
.It was suppose to take 1 second to change the zoom from 1 to 2, another 1 second to change 2 to 4.
However, there's some bugs:
https://github.com/EngoEngine/engo/blob/db964088800cfff0d9f08710dd4391607189a53c/common/camera.go#L171
That doesn't work. The
time.Duration
isint64
. If the game is running at 60 FPS thedt
will be 0.16 seconds, which will be 0, sinceint64(float32(0.16))
is 0. It creates a infinite loop. I think the solution must be:Then, have another problem, which seems to be caused by
longTask.speed = longTask.Value / float32(longTask.Duration.Seconds())
whenlongTask.Incremental = false
. It should befalse
since it is a "steped" zoom.I'm trying to fix that, but I think it will be very different from the current implementation. 😐