Do object layer objects have pivots and tile position?

Hi.

I’m new to this forum.

I was testing if I could use Tiled for some Unity game concepts of mine. However after quick test in Tiled and after reading the docs, I couldn’t find any information about these;

A.Is it possible to define a pivot point for object layer objects? When objects are manipulated using move or rotate tools, they seem to have some temporary pivot point marked by cross hair. However, there doesn’t seem to be any such data stored in object Properties.

B. Object rotation by changing rotation value in object Properties seems to be really erratic. I didn’t pinpoint the logic, but it doesn’t rotate object shape around it center - how does this work?

C. Is it possible to automatically store a tile position for object? There doesn’t seem to be such data available in object Properties by default. If object center/pivot is inside a tile layer tile, it would automatically get a tile coordinate in addition x and y. This would be really helpful.

D. Is there some known bug with add objects as the handles for box and circle shapes are collapsed to center of the shape. Only after clicking and dragging the shape manipulation arrows I can get them snapped to bounding box of the shape. Seems like a bug. I’m using 1.3.0.

Thanks in advance!

Objects rotate around their position. So when you rotate an object using the Object Selection tool, the tool adjusts the position of the object to make it rotate around the displayed (and movable) anchor point. There is currently no “pivot point”, though it’s something I’d like to add support for.

The object rotates around its position, not its center. The position of the object is generally in the top-left for shapes and bottom-left for tile objects. Once we support a configurable pivot point it can be used to have objects rotate around their center.

Tiles can be drawn at an offset, but this offset is currently defined globally for all tiles in a certain tileset (Drawing Offset is a tileset property). There are plans to make this per-tile (essentially introducing a configurable pivot point for tile objects). See issue https://github.com/bjorn/tiled/issues/871.

This happens when the object has zero size. Rather than ending up with an invisible unable-to-interact-with object, the object is rendered with a fixed size around its position. But the handles indicate the object does not have a size, and dragging the handles will “fix” the object by giving it a proper size.

Probably it’s too easy to create such zero size objects, and simply clicking with the create object tool should possibly do nothing. Previously, zero sized objects were essentially supported as a way of placing point objects, but for this purpose an explicit point object type was introduced in Tiled 1.1.

Thank you for the reply.

Having pivot and tile coordinates would be really helpful.

About object handles - If I select Insert Rectangle, hover over map, and click once, then select newly created rectangle, with Select Objects (S) tool right after previous step, I get handles in center of new rectangle. This happens every time.

So might it be that there is some initialization issue with new object bounds perhaps? Anyway, to fix this, I have to drag one corner of tile, so I ruin its shape, and then after I end drag, the handles will pop to correct location. I just downloaded 1.3.1 and still have the same issue.

Edit, here is a video:
object_handles

Right, this is exactly what I tried to describe. Simply clicking without dragging currently creates a zero-sized object, and in order to keep it visible and selectable, it is drawn with a fixed size rather than as zero-sized rectangle. I was wondering if it may be more helpful if clicking didn’t do anything at all. Or maybe it should create the object with a default fixed size, but which size then? And then there remains the problem that you could create an invisible object by resizing an object down to zero.

I understand, but wouldn’t the logical UX choice be to draw the default size box and handles for it? I already got the shape I see on screen, so what could go wrong?

Having default size box and zero size handles makes no sense to me. If you compare this behavior to nearly any other content creation software, this is not the way they work.

You don’t have the shape you see on the screen, that’s the problem. You have a zero-sized object that is essentially represented in the wrong way.

If you come upon any software that behaves better please let me know in which way they do it better. I’ve checked with Inkscape, and it essentially does what I’ve been suggesting here: refuse to create zero-size objects. When you create zero-size objects anyway by resizing them afterwards, you get an object that is invisible and hard to interact with, but at that point it’s kind of your own fault anyway.

I’d like to also remove the hack that renders objects larger than they are, to make appearance consistent with the resize handles. But one problem with changing that behavior now in Tiled is that any maps created with older versions of Tiled may contain zero-size objects that used to be clearly visible, selectable and movable but would become hard to find. Changing the resize handles instead to match the essentially wrongly rendered objects is likely going to make for a very tough hack with more weird behavior.

One solution there is to check the file format version and to automatically turn such objects into point objects for older files.

Can’t it simply be the usual default behavior;

Click - create default rectangle, circle or whatever shape and place handles for it.

Click+drag - create user defined shape with proper handles.

Edit: I do have to admit, I can’t pinpoint any software :slight_smile:

So, the latter will of course work, but the former needs a default size, and I’m not sure what it should be. Inkscape doesn’t have one and thus requires a click+drag to create such objects. That may be just fine? I’ll just give it a try I guess.

Edit: Found https://vectr.com/, which creates shapes at 40x40px by default instead of doing nothing when you don’t drag. But I think it’s rather arbitrary.