PhysicsEditor-Loaders icon indicating copy to clipboard operation
PhysicsEditor-Loaders copied to clipboard

Fixtures export with a top-right translation

Open katccat opened this issue 1 year ago • 1 comments
trafficstars

When I chose the LibGDX exporter I kept noticing that bodies created using data from the PhysicsEditor would end up nowhere near the location of the Box2d BodyDef passed to the createBody method of the PhysicsShapeCache object. That is because as long as you draw fixtures within the canvas borders, every coordinate will be positive and that is either an oversight or it is just handled incorrectly by the loader. For example, in order for this fixture to be centered horizontally in game, it has to be clipping in the middle of the editor's left wall. Screenshot 2024-08-24 at 22 13 24

katccat avatar Aug 25 '24 02:08 katccat

It might also depend on how you use your sprites. If this is the correct offset, it looks to me like you are using a trimmed sprite and draw it around its center - but it's hard to know from the details you are providing here.

Can you check out this tutorial: https://www.codeandweb.com/physicseditor/tutorials/libgdx-physics

It might help you getting it fixed.

CodeAndWeb avatar Sep 05 '24 07:09 CodeAndWeb