Polyline line width / line thickness

For my game, I’d like to create a track like a rollercoaster or a track like in line rider. I can do this with a polyline in the editor. It would be nice to visualise the physical line thickness in the editor. This helps me see where my player character would physically hit the line if the line has a thickness in the game.

I know there is a user interface setting “object line width”, but this is not what I mean. The setting is independent of zoom level, while I want it to become larger when zoomed in. Also, I’d like to be able to set line thickness for lines individuallly.

Would this require a new feature in the editor? Or is it possible to define a new object type with a plugin and then also write code to visualise it? If possible that would probably be a lot of work unless I can use the existing polyline as a basis. But I suppose that is written in the core in c++, not as a js plugin

1 Like

It is not possible to display the thickness of Polylines differently via plugins or scripts. Neither can add new types of visualisation either, they can only work with native Tiled entity types and their existing visualisation. Adding new visualisation or wholly new features requires editing Tiled itself.
(To clarify my terminology: Plugins are C++ and have to be compiled alongside Tiled, they’re the things you enable in Edit > Preferences > Plugins. Scripts, or scripted extensions, are the JS ones, and they’re much simpler to get running.)

Something you could do via a script is to create a Polygon that’s an extruded version of the Polyline. This could just be an action you run that creates/updates this Polygon for each Polyline. Alternatively, you could create a custom Tool that lets you create/edit a Polyline and its preview Polyline at the same time. If you don’t want this preview Polygon in your map files, you can have the script react to tiled.assetAboutToBeSaved by deleting the layer these polygons are on, and then bringing it back on tiled.assetSaved.

1 Like

OK, if this not a feature-request worth pursuing I’ll go with one of the workarounds you proposed; thanks

1 Like