How do i make a pendulum simulation

Hi, i am trying to recreate a pendulum simulation.
In this simulation, i should be able to use the mouse to move the pendulum around.
Additionally, the user can change the pendulum’s weight, the rope’s height, the gravity and the friction.
I haven’t used gdevelop 5 in quite a long time so i have forgotten most of the app’s function.
It would be great if you could point out which function i could use to achieve my goals.
Many thanks

Sounds like you could use physics and physics joints like rope and a mouse joint to move it or maybe force.

https://wiki.gdevelop.io/gdevelop5/behaviors/physics2/#controlling-object-movement-with-joints

2 Likes

HI, thank you for your suggestion! I have almost complete the simulation, only a few details left.
I have use draggable physic to move the pendulum around and rope joint to hang it up. Do you know how I can show what’s the angle of the pendulum when I move it up ?

There are a few angle expressions.
You could add a text object and use

This gets the angle based on 0 to 180 and 0 to 180. So, you’d probably want to modify it to 0 to 360 and round it to an integer, depending on the needed accuracy.

Hi Vinh, great to hear your simulation is almost done! To show the pendulum’s angle, you can use angle expressions in GDevelop. You can display the angle value with a text object and adjust it to show the angle in 0-360 degrees. Rounding the value might make it easier to read. Hope this helps