Applying forces in equal and opposite directions for jumping

Godot Version

4.6

Question

Hello! I'm looking for resources for a specific goal of mine, and though I'm not sure what to search for, I feel as though someone knows how to do this already.

what I’ve created is a jump where when the character jumps, force is applied downward also. it looks amazing on wobbly platforms and such.

what I would like is for the force to be divided between the the platform and the character in a way where if the ground is wobbly, it pushes away, resulting in a weaker jump.

my current idea (don’t know if it will work) is to calculate the force, then get the platform velocity, apply the force to the platform below, then force a physics update and get the new velocity. do some math?? divide the force using said math, and apply the remaining force to the character for the jump.

I won’t get around to testing out code for a bit, so I’m mostly looking for resources and ideas. I’m note sure if forcing the physics update will work, and I don’t know enough physics and math (yet) to know what I should be searching for.

if anyone has anything to share, I’m all ears!

Is this a 2D or 3D game? I’d recommend you play around with the AnimatableBody2D/3D node. You might be able to do most of what you want by playing with its settings. You can use them to apply their force to the player, so if you just have them fall away when the player hits the jump button on them, you can apply the force of the platform falling away and it’ll have the same effect.

I think I will end up doing something like this but the idea is that on a hard surface you jump higher than on a movable surface because the surface is pushed down from the force of the jump.

My current plan is to keep the current system and add refinements like you suggested. But it seems like this is such a realistic way for physics to operate, someone must have coded it already.

So far, I tried using physics joints, but the behavior was erratic. Every time I try using joints I end up experimenting way too much to get it to feel right.

edit: it’s a 3D game lol sorry.
I am also going to look at using animatable body as a foot that pushes off the floor, but I don’t know how it will behave as a child of a rigidbody :confused: