My problem is quite simple. I wish the red block to stay inside the box correctly (ie it properly accompany the box, keeping within it) using physics. I already tried put higher values in physics iterations (did not work) and also tried to move the box to be using physics instead of 8-dir moviment, the problem remained the same)
there is the capx:
it's a physics problem? where is a way to solve this?
Develop games in your browser. Powerful, performant & highly capable.
You've got a lot of mixed things going on there, which breaks the physics behaviour. Don't use set position, don't use 8-direction, don't use anything that manually overrides the physics behaviour.
Instead, rework your project so that any object involved in the physics interactions is set to use physics forces, impulses and/or torque. Anything else that doesn't directly affect the positioning of physics objects (like the box front) should not have the physics behaviour.