+1 vote

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

in Engine by (16 points)

1 Answer

+2 votes
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)

by (29,088 points)
selected by

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.