RigidBody2D as player

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

I want to use a RigidBody2d as a player in a game I’m making, as it has a lot of physics implementations. The issue with this is that I don’t know how to make a RigidBody2D move when you press keys (I do for a KinematicBody2D though). Is there any simple lines of code that would allow this? I am new to Godot so any help would be appreciated.

:bust_in_silhouette: Reply From: kidscancode

Using a RigidBody2D means the physics engine has control of the body, so you have to work with it. This means that you move it by applying forces, and this is not as straightforward as moving a non-physics body.

There’s an example of spaceship-style movement using a rigid body in the docs: