# Collision and Gravity of objects

Hi,
Found GDevelop very much useful for developing simple Maths activities for my students in the primary classes, but got stuck in one such project. Seeking help from the community.
A common balance on screen for understanding numbers. Weights equivalent to each number is to be placed on the right or left pan on the balance. The balance should tilt proportional to the the weight difference and return to ‘0’ position if weights are equal.
Tried using the behaviours - Physics and Draggable but something wrong somewhere.
Could some one help?
Any one already doing such educational games?

Rhithu
resources.zip (260 KB)
Study.gdg (63 KB)

My first thought is that you should use the diff variable to set the speed of movement of the balance, not its angle. It should have a fixed angle that it moves to, so that it hits, but doesn’t go into, the base object. At the moment it’s behaving more like a needle on a gauge.

Is the ultimate goal that the pans and balls will move with the balance? If not, then you may not need the physics behaviour.

I know it’s only an early prototype, but I found it annoying not being able to move the cannonballs after they had been placed.

Changing the events like this…

…means that they will drop if you end a drag outside the blue zone (which is a little bit more exciting) and you can also pick them up off the pans and place them back in the blue area (or onto the other pan).

Thanks. The whole thing should resemble a real weighing balance. That means, the pans and balls in the pan must always be pinned to the lever and move along with the lever. The angle it moves should be proportional to the value of variable,diff.
I tried your suggestion of changing the angular speed of lever instead of rotating it, but that didn’t work.

Hi, the problem is that you rotate towards “- Variable(diff)” when the left lever weight is greater than right lever’s, but you already have the sign in the “diff” variable, so you can replace the three possible scenarios with just one:

You can multiply the variable by some factor to increase the angle moved by the difference

That’s an idea… thanks.
How is it possible to pin the pan and balls with the lever when it moves?