Physics2: Platform declining based on players weight (density) [SOLVED]

How do I…

How do I make platform, that reacts to players weight (Density)?

What is the expected result

When player touches the platform, platform should start to decline. When I increase players weight (density), it should decline faster.

What is the actual result

I made plaftorm working on Physics2 behavior, that it response to player by using Center point for Revolute joint. So the platform leans according to where player is. However I dont know how to make it decline.

To be honest, I dont know where to get more information on how to use and understand joints and whole Physics2 behavior. I watched few times tutorials, tried to play with example game, but still I am not sure what I am doing.

My target is to make in a game platform, that would be hanging on two balloons, each tide on each side of the platform. When player steps onto this platform, it should start to decline (based on player weight) and also to lean (based on player position towards center of platform).

In addition, that platform can hang on two different balloons - the bigger will automaticly pull one side higher then the other. So there should be in the future one more variable based on balloons power.

Hopefully this will make my goal more clear.

But now, just for the beginning and understanding basics, I would love to understand, how make basic behavior of platform to realct on collision with player by leaning and declining.

Thank you!

That’s an interesting concept. Instead of changing the joint, I decided to change the gravity of the balloons using a negative value for their gravity scale. I added ropes to lift the platform and a second set to prevent them from floating away. There might be a simpler way to do this but this is the most realistic.

I put together a test project. I used rope joints and a shape painter to draw them. There are 2 sliders to control the gravity scale of the balloons and a switch to sync them.

The blocks on the left are drageable as well as the green platform and balloons.
https://games.gdevelop-app.com/game-3ed002ab-bbd9-4dfb-a87d-e816d36aa4e5/index.html

source: (click the green [code] button and select [download zip], extract and open the json file)

Edit: This is really too erratic but it’s a nice concept. Other joint type might be better or maybe it can be used in connection with another joint.

3 Likes

Wow, this is very helpful. I will play with that and will come back with more questions, if there will be any :slight_smile:
Thank you very much!

2 Likes

I would like to once more thank you! I played with your solution and I love its simplicity. I feel I can work with this solution and also it showed me few other options. how to use some gdev mechanics.

Thank you! :slight_smile:

2 Likes