Where are the GDScript Class-Definitions in the Code of the Engine

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Linuxer4Fun
:warning: Old Version Published before Godot 3 was released.

Hello,

I wanted to contribute to the engine, Unfortunately, I can’t find the
location of the GDScript-Class Definitions (more precisely KinematicBody2D)

The only thing, I find are the Icons…

:bust_in_silhouette: Reply From: Zylann

What you are asking is a bit ambiguous, because GDScript is only one scripting language that goes on top of Godot’s C++ API. You could refer to:

  • The scripts or classes defined within .gd files
  • The C++ classes of the engine itself (Sprite, KinematicBody2D…)
  • The locations where C++ classes are made accessible to the API (which in turn allows GDScript or VisualScript to use them)

I think what you are looking for is scene/2d/physics_body_2d.h/.cpp, if you are looking for the C++ class itself.

(not obvious due to different filename, but a quick search will do with an IDE)

Thank you very much!

Another question: If I do

get_collider(),

I get a collider, but I don’t find that file either

Linuxer4Fun | 2017-01-10 15:23

get_collider returns a Variant, I guess it can be several types of physics nodes, or null. You may be able to cast it according its type: if it’s not null, then get the variant as an Object, then test its type through reflection, however I never did that before. You have to find it by yourself (I am busy at the moment sorry^^)

Zylann | 2017-01-10 19:55