Is there any reason not to use RigidBody2D for everything

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chugwig

Given that RigidBody2D has a mode that allows for acting like a KinematicBody2D and for acting like a StaticBody2D, is there any downside to using RigidBody2D for everything?

The biggest issue I can think of is the lack of move_* functions, but those functions are only useful for simple physics anyway and I don’t see why I couldn’t write my own functions that mimic the results using things like test_motion and set_axis_velocity.

Thinks I’m curious about:

  • Does RigidBody2D having a greater overhead than the other two even when in the appropriate mode (I have the impression that the mode reduces the feature set of the rigid body and that overhead should be similar to the node the mode is mimicing)
  • Is there some nuance of KinematicBody2D or StaticBody2D that isn’t the same as using a RigidBody2D in the matching mode? As far as I can tell, most if not all properties exported on Kinematic and Static bodies are present in some way for the RigidBody.
  • If there’s no issue with making my own move_* functions but using a RigidBody2D in “Kinematic” mode, are there any “gotchas” I should look out for?
    • Reading the Godot C++ code I’m already seeing that move_and_slide does a bit extra concerning if the body is on a moving platform and that I’d also have to manually handle things like is_on_floor() and such.
    • Anything else I’m missing?
  • Anything else people are aware of or if they’ve tried this and can let me know how it went that’d be extremely useful.

i have used rigidBody as a player node. I strongly advice to have a look into _integrate_forces() wich makes overwrite unwanted physics effects a breeze

One drawback in godot is that you only get one collision per collider. wich makes it hard to manage situations when you collide a corner.

klaas | 2020-08-25 14:05

Interesting thanks for the input! Did you ever try messing with your contacts_reported value to see if that fixed the issue with only getting one collision? The docs make it seem like you should be able to get more.

chugwig | 2020-08-25 14:15

… well … i dont remember. Try it and give us a comment on your progress!

klaas | 2020-08-25 22:12