|Topic was automatically imported from the old Question2Answer platform.
I’ve been making a BBTan Clone in Godot where balls are implemented as
KinematicBody2D. I have a Board class (which
extends Node2D) that holds other objects as children (boxes, triangles, player, balls, etc.). The feature I want to have is to be able to scale the Board so that I can fit it to the screen (in case of different screen resolutions, number of rows/columns).
I’ve tried to just change the scale of the Board node itself. Although it visually looks good (everything is scaled as it should), it introduces a bug with the movement of balls. No matter the scale of the Board, balls always move with the same speed on the screen while their movement should depend on the scale of the Board (so that the gameplay is the same, that’s why I put balls as children of the Board).
I found out that
move_and_collide() method on
KinematicBody2D uses the global transform to handle the movement so it’s not affected by the parent’s transform.
It looks like a killer to me. I think that the only way I can fix it is to change the positioning of children rather than changing the transform of their parent. But that feels bad because I thought it would be automatically handled by the engine.
Is there any other way to handle it?