Unsure of I should use a characterbody2d or a rigidbody2d

Godot Version

4.2

Question

I am trying to build a 2d sidescroller with the skiing movement out of tribes. Basically, when the player has no input the character moves based on inertia without friction. When they press the controller right or left instead of moving in that direction while touching the ground, a force is applied that accelerates/decelerates the character until it hits a top speed. And while the character presses the space bar, the character is accelerated up and to the current direction with no cap on speed.

I think I want to use the staticbody2d since pretty much all the motion is applied forces. But I am not sure how to do it without using a wheel.

CharacterBody2D
A 2D physics body specialized for characters moved by script.
https://docs.godotengine.org/en/stable/classes/class_characterbody2d.html

RigidBody2D
A 2D physics body that is moved by a physics simulation.
https://docs.godotengine.org/en/stable/classes/class_rigidbody2d.html

StaticBody2D
A 2D physics body that can’t be moved by external forces. When moved manually, it doesn’t affect other bodies in its path.
https://docs.godotengine.org/en/stable/classes/class_staticbody2d.html

For your 2D side-scroller game, I would definitely use a CharacterBody2D, but I suppose it all depends on your game design, idea and vision.

You should first build a prototype (which is what I imagine you are doing) so you can try them all out and see which one fits your game idea the best.

Good luck,

Paul

PS The docs are amazing BTW, make sure you have read them. I have learned so much from taking the time to read them and contributors have put a lot of time and effort into writing them. For an open source project, Godot docs are particularly good, perhaps even the finest I have ever seen.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.