In some cases, animated transformations may overshoot particular changes and change scale even when no scale change should occur, though corrects once the animation concludes.
Numbered Steps to Reproduce Problem:
View this library: http://puu.sh/aTPpX/b2ea6cd899.zip
It uses the code below with a few other resources to easily reproduce the problem.
Code Snippet (if applicable) to Reproduce Problem:
mob/proc/My_Animate(facing)
animate(src) //end any currently active animations.
sleep(1)
var/matrix
a = matrix()
b = matrix()
c = matrix()
b.Turn(20)
c.Turn(-40)
if(facing)
a.Scale(-1,1)
b.Scale(-1,1)
c.Scale(-1,1)
transform=a
animate(src,transform=b,time=20,easing=SINE_EASING)
animate(transform=c,time=80,easing=SINE_EASING)
Expected Results:
If 'facing' is zero, the object should tilt clockwise before tilting counterclockwise a moment afterwords.
If 'facing' is non-zero, the same should occur, but the object's icon should be flipped and rotations clockwise should instead be counterclockwise.
Actual Results:
If 'facing' is zero, and no scaling is applied, the result is a slight tilt clockwise before a large tilt counterclockwise on the mob. This is intended.
If 'facing' is non-zero and scaling is applied, the result is a slight tilt counterclockwise before a 'jump' clockwise, then scales to 2x the expected size while overshooting a clockwise rotation by approximately 2x the expected amount. At the end of the animation, the object jumps to the expected end point that you would expect from matrix c, so the error is purely visual with the animate() proc.
Does the problem occur:
Every time? Or how often?
Always.
In other games?
Tested in a blank project, so yes.
In other user accounts?
Indeed.
On other computers?
Yes.
When does the problem NOT occur?
It appears the problem occurs only while an object has been scaled by an amount less than zero on the x-axis. So if you don't use a matrix that has been manipulated by a proc such as "Scale(-1,1)" it generally will work fine. However, even with scaling, it works fine if we do not apply any rotation and the oddity with the unexpected scale change will not occur. In addition, it should be noted this issue does not occur when a matrix is manipulated by "Scale(-1,-1)"
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
Untested.
Workarounds:
Simply don't use negative scale matrices, and instead just use a flipped icon and reverse matrix transformations, which disallows the advantages of applying a purely visual flip to an object and all its attached parts and requires a fair bit more code to accomplish.