Best practice to work on world unit

I defined a world 16x16 unit (1 unit = 128 pixel) The game art is designed with 2048x2048 resolution.

Is there a best practice to demonstrate the world? Defold provides go.get_world_position() vs go.get_position(), so I think it has been supported but I aways get the same values as do the following changes :

  • Changed display width/height to any values in game object in game_object config
  • Edited : render.set_viewport(0, 0, anySize, anySize)
  • Edited : render.set_projection(vmath.matrix4_orthographic(0, anySize, 0, anySize, -1, 1))

go.get_world_position() and go.get_position() aways get the same values relating to the game art resolution designed in the editor (2048x2048).

The need to work on the world dimension to adapt with physic engine to get the best simulation but I’ve not got a chance to see the configuration and/or custom render script . Is there any best practise for this case.

In old engine I’ve worked before , there’s a configuration named as Pixel per world unit in the editor.

Thanks,
RG1

1 Like

get_position() returns the position relative to a parent object. If the object has no parent get_position() and get_world_position() returns the same value.

2 Likes

Thanks @sicher, the information is clear.

BTW, just need the confirmation or a best practice to work on game world space when using Defold. In the old engine,
it is able to set a viewport to a world size, then the position is relative to the world space and is not depend on the design resolution (pixel).

As I understand for now, the minimum world dimension should be equals or greater than the resolution which is set in game.object configuration and the design coordinate (what we see in the editor) whether or not I change the combination of view(camera), viewport and projection when using Defold.

Just need to be clarified b/c I do think that the modified box2D using in Defold is good enough to work with the large world space.