Charachter Bodies moving one another?

Godot Version

Godot 4.1


Is there any way to get Character Bodies to be able to push other Character Bodies around?

Because they are not affected by the physics process so im wondering if i could have a very general idea in code probably on how to implement this

If you’re using move_and_slide(), it will record its collisions which you can access with get_slide_collision().

The typical way to implement pushing is to check the collisions from move_and_slide() and update the velocity of the other objects (assuming they are pushable according to your game rules).

If you want more control, you can use move_and_collide() instead, but this can lead to more complex logic.

TYSM, a much nicer reply than Stackoverflow.

just to make sure I understand as much as I can:

get all the collisions of move_and_slide()

something : get_slide_collision().first_index or something along those lines

and use those collisions to tell which bodies to up date their velocities!

I guess i should re-design how my enemies node trees are set up but seems promising!!! Ty

1 Like