Calling create_convex_shape on arraymesh in gdnative cpp gives error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jujumumu

I am doing this all in gdnative with c++. When I make a arraymesh then call create_convex_shape on it I get an error which is “error: member access into incomplete type ‘godot::Shape’”
A simple version of the code is below:

ArrayMesh *amesh = ArrayMesh::_new();
Array vertexarray;
vertexarray.append(Vector3(0,1,0));
vertexarray.append(Vector3(0,0,1));
vertexarray.append(Vector3(1,0,0));
Array arrays;
arrays.resize(ArrayMesh::ARRAY_MAX);
arrays[ArrayMesh::ARRAY_VERTEX] = vertexarray;
amesh->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, arrays);
amesh->create_convex_shape();

I get the same error. How do I fix this?

:bust_in_silhouette: Reply From: sash-rc

error: member access into incomplete type ‘godot::Shape’

Such errors almost always means you missed include, in particular, you need

#include <Shape.hpp>