How can one dynamically adjust the size of a collision/trigger collision box during runtime?

I aim to enhance my gun’s range dynamically during runtime. If a user opts to upgrade the range, I intend to increase the trigger collision object’s radius. However, it seems challenging to achieve this without scaling the entire object, resulting in an undesired enlargement of the sprite. What would be the optimal approach in Defold? Is it necessary to rescale the entire game object and then readjust the sprite back to its original size afterward?

We very recently merged support for changing the size of collision shapes at runtime:

This will be available in an upcoming release but you can try it already in the 1.6.3 alpha: Release v1.6.3 - alpha · defold/defold · GitHub

5 Likes