Paper2D sprite component socket location is invalid

When a pixels-per-unit is not equal to 1.0, actual sprite component socket location is different from the one set in editor.
To reproduce this bug:

  1. Create a socket at (100.0, 0.0, 0.0) in sprite editor
  2. Set pixels-per-unit is set to 2.56 (which is a default value)
  3. Attach any actor to the created socket in blueprint components editor or in runtime using blueprint graph
  4. Actual relative attached actor location will be set to (39.0, 0.0, 0.0) (assuming parent actor is at (0, 0, 0)).

I think that pixel-per-unit value should only affect the sprite texture. As the sprite socket location is set in Unreal units (and not in pixels as other sprite parameters), I’ve created a simple pull request here: https://github.com/EpicGames/UnrealEngine/pull/416

This patch stops sprite component from scaling local transform translation with pixels-per-unit value.
Of course another solution would be to use pixel coordinates for sockets (this will always place sockets into same position relative to texture coordinates)

Hi RocknRolla,

The socket offsets are defined in pivot space right now, which has the same scale as texture space (but with Y flipped), and so they do need the pixels per unreal unit to be applied in order to get them into component space.

There is still a bug here, since the sockets appear at the wrong location in the sprite editor, but they are working correctly in the level editor (if you change the pixels per uu, an object attached to the socket in the level will move accordingly and stay at the same relative position to the rest of the image).

I’ve checked in some fixes that should fix the incorrect behavior inside of the sprite editor, these will be in 4.5 but you can grab them now if you are compiling from source:

Paper2D: Fix sockets being drawn at the wrong location in the sprite editor when pixels/uu is not 1.0
https://github.com/EpicGames/UnrealEngine/commit/67b7241c1a1bdf00d8e11117150ce629da1a74e4

Paper2D: Fix socket gizmo manipulation feeling sluggish when pixels/uu is not 1.0
https://github.com/EpicGames/UnrealEngine/commit/ba7c4b293c539b3101ec7a11ea575de54c056b77

Cheers,
Michael Noland

Hi Michael,

Yeah, I thought the solution to use texture space coordinates is the right one. Mine was a quick dirty fix.
Thank you for your answer!