+3 votes

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 testmotion and setaxisvelocity.

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 moveandslide does a bit extra concerning if the body is on a moving platform and that I'd also have to manually handle things like isonfloor() 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.
in Engine by (97 points)

Hi,
i have used rigidBody as a player node. I strongly advice to have a look into integrateforces() 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.

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.

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.