C++ Questions

2

Solved

I'm trying to write a module using tree-sitter with some custom grammars. Here's a minimal example that works outside of Godot: /* main.cpp */ #include <tree_sitter/api.h> int main() { TSParse...
Fiddler asked 15/2 at 23:35

3

I am creating a Player character for my game that at its core has 4 States. Idle, Moving, Attacking and Defending. The problem I am facing is mixed states. For example when a player moves and attack...
Shingly asked 12/2 at 11:30

16

Hello, I want to create a form of "dynamic animations" where the player character doesn't have pre defined animations but with some "guidance" generates them dynamically. What I have tried and has fai...
Delectable asked 4/2 at 11:36

41

Hello! As a few people have figured it out the hard way, Godot 4 native physics is a little bit unstable in some situations. And there was even a petition 🙂 regarding returning Bullet physics back i...
Geniegenii asked 24/4, 2023 at 20:19

1

Let's say I have 3 Buttons and I want only one function to get triggered by their pressed() signal. Inside the function I of course would like to know which button got pressed. The GDScript solution ...
Phloem asked 21/1 at 14:23

5

Hello. I am quite new to godot so hopefully it's not something obvious. When I use add_child() in GDScript the child is getting the _process() calls automatically in its own script. I made a Node2d ...
Cottle asked 19/1 at 16:54

4

Hi I'm looking at the documentation, and I can't find on what targets is GDExtension supported. I understand that 4.2 added support for Web, but what about Android and iOS? If not, would you use modul...
Resnatron asked 30/11, 2023 at 19:39

1

I can add symbolic breakpoints in Xcode with debug build. Breakpoints are hit. Calling stack is showed. But source code is not showed. Is there any settings to get the source code in debugging?
Zwolle asked 23/11, 2023 at 3:35

3

Solved

I could not find the code that generates the gdvirtual.gen.inc file in the source code Does anyone know where the path is? Thanks
Bangor asked 5/11, 2023 at 14:2

2

I'm working on my first Godot 4.1 extension with GDExtension. I don't really know C++, I'm mostly a Golang and Python developer. Currently, I'm facing a challenge: I want to use a custom type as retur...
Fireproof asked 3/11, 2023 at 17:20

2

so i have been debugging for the past 2 hours and i just cant find the problem
Cyder asked 22/10, 2023 at 19:17

4

The code to wrap the hex tiles around the camera works in the editor, but doesn't work in game. I'm think it has something to do with getting the NodePath of the cameraRig, because in the debugger, I'...
Burnejones asked 18/10, 2023 at 19:26

1

Are there C++ forward declarations for godot classes? Background: when declaring, in a header file, a class member that is a pointer to a godot class, e.g. ::godot::Node * pointerToNode, I need to ei...
Mahmoud asked 13/10, 2023 at 16:24

7

When creating a ::godot::Node we should use memnew instead of new. I have made a subclass of Node3D that has two constructor parameters. I tried to create an instance with memnew (MySubclassOfNode3D ...
Downcome asked 12/10, 2023 at 16:30

3

Solved

I have an Object and I want to check to ensure it is valid before manipulating it. Now I know the best thing to do in C++ is to properly manage my scope so that there is no possibility for the Object ...
Greave asked 26/8, 2023 at 6:34

2

Solved

Hello, i have a custom module which works if i run my game in godot editor, i built custom export templates via: scons target=template_debug dev_build=yes scons target=template_release dev_build=yes T...
Apothecary asked 16/10, 2023 at 13:49

2

I know I need to ResourceLoader::get_singleton(), but I don't know what files to #include, and I'm not keen with using the ResourceLoader. I've got an ArrayMesh saved as "res://Assets/HexMesh.tres" th...
Candlepin asked 16/10, 2023 at 20:17

3

In the inspector, it will show the boxes for the values: But I can't edit them, instead getting this output: Set numCol core/object/class_db.cpp:1642 - Instantiated Node3D used as default value for ...
Timehonored asked 15/10, 2023 at 0:25

7

I've #include <godot_cpp/core/vector3.hpp>, but it returns this output: src/hexmap.cpp:4:10: fatal error: godot_cpp/core/math/vector3.hpp: No such file or directory 4 | #include <godot_cpp/c...
Benzoic asked 13/10, 2023 at 14:36

1

As the title states, code compiles, but won't load, stating "Error loading extension: res://bin/test.gdextension" test.h: #ifndef TEST_H #define TEST_H #include <godot_cpp/classes/node3d.hpp> ...
Barong asked 12/10, 2023 at 17:32

13

Back in 2019, I had a hex map project that I was initially writing in GDScript, however, GDScript got to be too slow when getting the tiles to follow the camera. I ended up having to rewrite the entir...
Jurisprudence asked 10/10, 2023 at 10:58

3

Hello ! 😃 I have a question about the life cycle of nodes implemented in GDExtension (C++ in my case), in particular in the editor. I just finished the tutorial with the GDExtension C++ example : ...
Rosana asked 5/10, 2023 at 10:25

5

How should I handle exceptions in my plugins? I tried using various libraries and in some cases they can break Godot, which leads to the program crashing.
Kronos asked 11/10, 2023 at 1:34

1

I have a class named Slot. Now I want to add it to Array. Slot *slot = memnew(Slot()); Array array; array.push_back(slot); array[0]; But I found that the type of array[0] is Variant. If I want to ge...
Erratum asked 19/6, 2023 at 16:26

2

I am developing a gdextension. I'm one of those people who cannot live without C++. Also, I'm binding to other, external C++ libraries. Let's say in my C++ code I have a Transform3D called t and a Ve...
Mandrel asked 4/10, 2023 at 15:57

© 2022 - 2024 — McMap. All rights reserved.