0 votes

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...

asked Jan 10 in Engine by Linuxer4Fun (15 points)

1 Answer

+1 vote
Best answer

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.
https://github.com/godotengine/godot/blob/master/scene/2d/physics_body_2d.h#L291
(not obvious due to different filename, but a quick search will do with an IDE)

answered Jan 10 by Zylann (9,766 points)
selected Jan 10 by Linuxer4Fun

Thank you very much!

Another question: If I do

get_collider(),

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

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^^)

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 How to use this Q&A? before posting your first questions.