It has been awhile since I've poked around on the C++ side of things, but you probably need to look for the add_force
in the class itself using a keyword search for add_force
to find the function. For example, the function is defined in physics_body.cpp on line 818, however this just calls a function in the Physics Server, and the binding that exposes this function in the RigidBody to GDScript is on line 982.
Inspecting the function for the visual server, you will find a stub function. To find the actual implementation, you have to know which of the two Godot physics servers you want, Bullet (default) or Godot's software implementation.
For Bullet physics, the function is on line 122 in rigid_body_bullet.cpp, which calls a function called apply_force
, which is on line 653, where it finally calls applyForce
to the Bullet physics body.
So, yeah, navigating the source is a tad difficult and depending on what you are looking for, it is not intuitive either. Some of the nodes and their functions are implemented in the files you would expect, like camera_2d.cpp
for example, but there are a few that can lead you jumping around the source code looking for the implementation. Unfortunately, I do not know if any way to navigate through the code easily, but the last time I contributed to the C++ side of things was a year or to ago and I only have basic C++ skills, so it is entirely possible that I am missing something.
Hopefully this helps a bit!
(Side note: Welcome to the forums)