ID:1379369
 
Resolved
Images and overlays with transforms applied them in the wrong order relative to the parent object, so an overlay with translation would not revolve around a rotating parent.
BYOND Version:500.1208
Operating System:Windows 8 Pro 64-bit
Web Browser:Chrome 30.0.1599.37
Applies to:Dream Seeker
Status: Resolved (500.1209)

This issue has been resolved.
Descriptive Problem Summary:
When attaching images or overlays with an offset (through translation matrix or pixel_x/y) to an object, rotating that object doesn't cause the attached images to revolve around the object. The images only spin in place.

Numbered Steps to Reproduce Problem:
1. Make image
2. Translate image's transform
3. Attach image to object
4. Make object constantly spin

Code Snippet (if applicable) to Reproduce Problem:
world
maxx = 5
maxy = 5
fps = 30

var matrix/Matrix

mob/Login()
..()

// A white circle in the center of the world
loc = locate(3, 3, 1)
icon = 'shapes.dmi'
icon_state = "circle"

// A red square with an offset of (0, 32)
var image/i = image('shapes.dmi', "square")
i.color = "red"
Matrix = new
Matrix.Translate(0, 32)
i.transform = Matrix

overlays += i
// Can also use i.loc; src << i

// Spin src constantly
animate(src, transform = turn(transform, 120), time = 10/3, loop = -1)
animate(transform = turn(transform, 120), time = 10/3)
animate(transform = turn(transform, 120), time = 10/3)
// Can also use an infinite loop
// and transform = turn(etc.


Expected Results:
Red square revolves around the white circle

Actual Results:
Red square spins in place on top of the white circle

Does the problem occur:
Every time? Or how often? every time
In other games? eh
In other user accounts? sure
On other computers? yep

When does the problem NOT occur?
In the future, I guess

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)


Workarounds:
Rotate the image's transform. This is bad.
Oh, dang. I know what's going on here: The matrix multiplication is being done in the wrong order. The overlay's transform should be done first, and then the parent object's transform should be attached to that. Excellent catch.

Pixel offsets won't be subject to rotations from the parent object, so a translation like you're doing will be the only wan to achieve this effect when the issue is taken care of.
Lummox JR resolved issue with message:
Images and overlays with transforms applied them in the wrong order relative to the parent object, so an overlay with translation would not revolve around a rotating parent.