create_trimesh_shape returns no shape

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

The game instantiates this object every frame, this object creates two triangles using surfaceTool. The mesh itself is being created and I can see it runtime, but when i create the collision shape from the mesh it returns null.
Don’t focus on vertices, I’m sure they are ok, the problem is that it doesn’t create a collision shape from the mesh.

func _ready():

surfTool.begin(Mesh.PRIMITIVE_TRIANGLES)
surfTool.add_vertex(oP1)
surfTool.add_vertex(oP2)
surfTool.add_vertex(nP1)
surfTool.add_vertex(nP2)

surfTool.index()

surfTool.add_index(1)
surfTool.add_index(2)
surfTool.add_index(3)

mesh = surfTool.commit()
get_parent().get_node("CollisionShape").shape = mesh.create_trimesh_shape()

If I create the shape using create_convex_shape(), a shape is created and it works, but I guess that this way is slower.