[solved] Segmentation fault because this == 0

madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

[solved] Segmentation fault because this == 0

Post by madMAx4 »

Hi,

I have two bodys with a btTriangleMeshShape in my scene, a box and the terrain. i registered the btConvexConvexAlgorithm for this collision.

when the box is meant to collide with the terrain, i think it first checks the bounding boxes of the two shapes, i get a segfault.
by replacing the following line of code in btStridingMeshInterface::InternalProcessAllTriangles():

Code: Select all

int graphicssubparts = getNumSubParts();
by

Code: Select all

int graphicssubparts = 1;
the segfault occours while _calling_ btTriangleMesh::getLockedReadOnlyVertexIndexBase(), an debug output immediately at the beginnig of this funtion is not printed.

this is very strange to me because getNumSubParts() only returns 1:

Code: Select all

int		btTriangleMesh::getNumSubParts() const
{
	return 1;
}
i think i need help at this point :shock:
thx

EDIT: getNumSubParts() is processed a thousands of times before the box collides with the bounding box of the terrain. even much more strange :shock:

EDIT2:
now i'm checking against this == 0 at the beginning of btStridingMeshInterface::InternalProcessAllTriangles() and actually after some calls it's 0 and segfaults.
but why doesn't it segfault while calling InternalProcessAllTriangles()?
it's not static, too!
really need help!
Last edited by madMAx4 on Sat Apr 21, 2007 2:24 pm, edited 1 time in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

btTriangleMeshShape is not supposed to be used for moving objects. So can you use btBoxShape (or btConvexShape) instead for the moving box?
madMAx4
Posts: 27
Joined: Fri Apr 20, 2007 7:29 pm
Location: Germany

Post by madMAx4 »

thx for your reply, that explains a lot.
but how can i add the vertices an indices to btConvexShape.
and whats about btConvexTriangleMeshShape?

btw: i just tried btTriangleIndexVertexArray and it's the same.

EDIT: with btConvexTriangleMeshShape the this pointer gets added by 15408h (87048d) sometimes and then segfaults.

EDIT2:
yeah i just got the difference between convex and concave and noticed that a btConvexHullShape fits perfectly my needs (simulated mechs).
and i just set up GIMPACT collision and it works great 8)
thx for your help.