Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by richard » Wed Mar 30, 2011 10:42 pm
In the current SVN head for API version 200 (I'm currently unable to build 300) the following code reliably crashes NewtonTreeCollisionEndBuild:
- Code: Select all
#include "newton/Newton.h"
float ground_tris[2][9] = {
-10.0, 0.0, -10.0, 10.0, 0.0, 10.0, -10.0, 0.0, 10.0,
-10.0, 0.0, -10.0, 10.0, 0.0, -10.0, 10.0, 0.0, 10.0,
};
int main(int argc, char **argv) {
NewtonWorld world = NewtonCreate();
NewtonCollision tree = NewtonCreateTreeCollision(world, 0);
NewtonTreeCollisionBeginBuild(tree);
NewtonTreeCollisionAddFace(tree, 3, ground_tris[0], sizeof(float)*3, 0);
NewtonTreeCollisionAddFace(tree, 3, ground_tris[1], sizeof(float)*3, 0);
NewtonTreeCollisionEndBuild(tree, 1);
return(0);
}
Such as:
- Code: Select all
(gdb) r
Starting program: /Users/richard/src/projects/newpy/a.out
Reading symbols for shared libraries +++. done
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x00035b27 in dgAABBPolygonSoup::Create ()
(gdb) bt
#0 0x00035b27 in dgAABBPolygonSoup::Create ()
#1 0x000bdc78 in dgCollisionBVH::EndBuild ()
#2 0x00001ee8 in main ()
(gdb)
Introducing a slight variation in y - setting the first vertex to have a y value of 1.0 - prevents the bug. I guess there's just something in the building that doesn't handle the vertexes all being on the xz plane.
-
richard
-
- Posts: 4
- Joined: Wed Mar 30, 2011 10:37 pm
by Julio Jerez » Wed Mar 30, 2011 11:56 pm
two things:
1- Hwo can this work?
NewtonWorld world = NewtonCreate();
NewtonCollision tree = NewtonCreateTreeCollision(world, 0);
should it be?
NewtonWorld* world = NewtonCreate();
NewtonCollision* tree = NewtonCreateTreeCollision(world, 0);
2- you are optimizing the collision tree and liek I said I commnet out few fuintion because I was chnagomn teh conve hull to use float so that I can use it for a more complex funtionality.
I am fix that now.
I think if you write your function like this:
- Code: Select all
int main(int argc, char **argv)
{
NewtonWorld* world = NewtonCreate();
NewtonCollision* tree = NewtonCreateTreeCollision(world, 0);
NewtonTreeCollisionBeginBuild(tree);
NewtonTreeCollisionAddFace(tree, 3, ground_tris[0], sizeof(float)*3, 0);
NewtonTreeCollisionAddFace(tree, 3, ground_tris[1], sizeof(float)*3, 0);
// see here
NewtonTreeCollisionEndBuild(tree, 0);
return(0);
}
It will work for now untill I check the fixed version tonight.
version 300 is not to be use yet, because only few things work there.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by richard » Thu Mar 31, 2011 7:27 pm
Julio Jerez wrote:NewtonWorld world = NewtonCreate();
NewtonCollision tree = NewtonCreateTreeCollision(world, 0);
Yeah, sorry about that. I edited the code after posting and screwed up
I've confirmed that turning off optimisation prevents the bug from being tripped. Thanks!
-
richard
-
- Posts: 4
- Joined: Wed Mar 30, 2011 10:37 pm
by Julio Jerez » Thu Mar 31, 2011 7:35 pm
it is fixed, it should work with optimization on too.
The optimization in important for collision performamce.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by richard » Thu Mar 31, 2011 11:13 pm
Excellent, thanks!
-
richard
-
- Posts: 4
- Joined: Wed Mar 30, 2011 10:37 pm
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 8 guests