Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by collerblade » Sun Apr 24, 2011 8:27 am
Hello everyone
I tried to create a treecollision with two simple face (triangle). Actually it is a quad. But there is some optimalization problems with it. If i dont use tree collision optimalization (with NewtonTreeCollisionEndBuild(..,1)), it's fine. With optimalization the result is crash. Other meshes working fine with optimalization & without optimalization. So i think the problem is somewhere int the optimalization methods..
Coordinates of the faces:
face 1:
1. x: -50.000 y: 0.000 z: 50.000
2. x: 50.000 y: 0.000 z: 50.000
3. x: -50.000 y: 0.000 z: -50.000
face2:
1. x: -50.000 y: 0.000 z: -50.000
2. x: 50.000 y: 0.000 z: 50.000
3. x: 50.000 y: 0.000 z: -50.000
I'm using the new stable version 2.33 & i tried the 2.31 as well. The promlem is the same.
I hope its helps eluminating some bugs.
gg
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by JernejL » Sun Apr 24, 2011 9:59 am
How is it a quad when you send two 3-point faces to it?
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by collerblade » Sun Apr 24, 2011 10:23 am
A quad from 2 triangles....
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by Julio Jerez » Sun Apr 24, 2011 11:02 am
I just pasted your data into one of the demos,
- Code: Select all
void SimpleConvexShatter (DemoEntityManager* const scene)
{
// suspend simulation before making changes to the physics world
scene->StopsExecution ();
// load the skybox
scene->Append(new SkyBox());
NewtonCollision* const collision = NewtonCreateTreeCollision(scene->GetNewton(), 0);
NewtonTreeCollisionBeginBuild(collision);
float xx[] = {-50.000, 0.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000,
-50.000, 0.000, -50.000,
50.000, 0.000, 50.000,
50.000, 0.000, -50.000};
NewtonTreeCollisionAddFace(collision, 3, &xx[0], 3 * sizeof (float), 0);
NewtonTreeCollisionAddFace(collision, 3, &xx[3], 3 * sizeof (float), 0);
NewtonTreeCollisionEndBuild(collision, 1);
I do not see any crash, what else do I have to do?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by collerblade » Sun Apr 24, 2011 4:06 pm
Re,
Now i tried out your code... crash :S. Im using delphi, but i dont see any mistake at all..
- Code: Select all
const vertices : array[0..8] of single =(
-50.000, 0.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000);
var collision : PNewtonCollision;
begin
collision:=NewtonCreateTreeCollision(newtonworld,0);
NewtonTreeCollisionBeginBuild(collision);
NewtonTreeCollisionAddFace(collision,3,@vertices[0],12,0);
NewtonTreeCollisionEndBuild(collision,1); //CRASH
end;
Now its crashing without optimalization as well
:(:(
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by Julio Jerez » Sun Apr 24, 2011 4:53 pm
how can that be? you have to have a bug some where.
It is no crashin here with one ot with tow faces.
are yo usure you have 2.33? a while back some one reported a bug with optimization, and I fix it, I am sure 2.33 has that correction
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by collerblade » Mon Apr 25, 2011 4:09 am
Hi
Happy easter
Soo. I downloaded the new version, but the NewtonWorldGetVersion give 231 as result.... maybe that could be the problem.
Otherwise: I tried 2 examples.
First:
- Code: Select all
const vertices : array[0..8] of single =(
-50.000, 0.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000);
var collision : PNewtonCollision;
begin
collision:=NewtonCreateTreeCollision(newtonworld,0);
NewtonTreeCollisionBeginBuild(collision);
NewtonTreeCollisionAddFace(collision,3,@vertices[0],12,0);
NewtonTreeCollisionEndBuild(collision,1); //CRASH
end;
It crashes any time, with or without optimalization as well.
A second example is with 2 triangles:
- Code: Select all
const vertices : array[0..17] of single =(
-50.000, 0.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000,
-50.000, 0.000, -50.000,
50.000, 0.000, 50.000,
50.000, 0.000, -50.000);
var collision : PNewtonCollision;
begin
collision:=NewtonCreateTreeCollision(newtonworld,0);
NewtonTreeCollisionBeginBuild(collision);
NewtonTreeCollisionAddFace(collision,3,@vertices[0],12,0);
NewtonTreeCollisionAddFace(collision,3,@vertices[9],12,0);
NewtonTreeCollisionEndBuild(collision,1); //CRASH
end;
This code crashes only with optimalization. Without optimalization its works, & the result shape is correct.
I dont know. I havent found any memory problems with my program. I tried to write out the values in vertices array, but they are correct.
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by collerblade » Mon Apr 25, 2011 4:22 am
Ohh just now i discovered the ultimate proof of the bug.
- Code: Select all
const vertices : array[0..17] of single =(
-50.000, 0.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000,
-50.000, 0.000, -50.000,
50.000, 0.000, 50.000,
50.000, 0.000, -50.000);
var collision : PNewtonCollision;
begin
collision:=NewtonCreateTreeCollision(newtonworld,0);
NewtonTreeCollisionBeginBuild(collision);
NewtonTreeCollisionAddFace(collision,3,@vertices[0],12,0);
NewtonTreeCollisionAddFace(collision,3,@vertices[9],12,0);
NewtonTreeCollisionEndBuild(collision,1); //CRASH
end;
This code crashes....
but this:
- Code: Select all
const vertices : array[0..17] of single =(
-50.000, 1.000, 50.000,
50.000, 0.000, 50.000,
-50.000, 0.000, -50.000,
-50.000, 0.000, -50.000,
50.000, 0.000, 50.000,
50.000, 0.000, -50.000);
var collision : PNewtonCollision;
begin
collision:=NewtonCreateTreeCollision(newtonworld,0);
NewtonTreeCollisionBeginBuild(collision);
NewtonTreeCollisionAddFace(collision,3,@vertices[0],12,0);
NewtonTreeCollisionAddFace(collision,3,@vertices[9],12,0);
NewtonTreeCollisionEndBuild(collision,1); //CRASH
end;
This is working fine with optimalization as well!!! And the diffference is only 1 value (as u can see). So it cant be any memory leak. I will try more examples...
Are u working with sse inside? (so 16 alignment?)
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by collerblade » Mon Apr 25, 2011 7:09 am
Re,
ok i tried several versions.
With 2.24, & 2.30 everything works fine. With or without optimization as well.
But i have 2.31 & 2.32 too. They are buggy. SAnother problem, that in 2.32, -using NewtonWorldGetVersion function- the result is 231. I compared the dll with 2.31 & they are the same. So the version of newton.dll in "package 2.32" is 2.31.
Now i see there is a 2.33. I forgot about it, sorry.
Ofc i tried it. There is no crash, but some weird thing going on with my body (with treecollision). The matrix (what i get by NewtonBodyGetMatrix() ) is not identity matrix. Its is changing in time (seems to me its random). I know treecollisions are static objects (at least theoretically)...... There is some other bodies in my scene, im going to clear them, that may fix the problem. But with 2.30 i get nice identity matrix, with the same scene.
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by JernejL » Mon Apr 25, 2011 7:23 am
I just tested your code with 2.33 and i get no crashes.
what is your newton architecture set to? ou should build a binary exe demo for julio to test and debug himself.
-
JernejL
-
- Posts: 1578
- Joined: Mon Dec 06, 2004 2:00 pm
- Location: Slovenia
-
by collerblade » Mon Apr 25, 2011 8:21 am
I made some progress..
The weird function is coused by the multibodyvehicle... i remove the car, everything works fine. :-S. I tried with older jointlibrary as well (2.30), but no changes.
First i call CreateCustomMultiBodyVehicle(). Its all good, but if i add 1 tire, the ground is starts to make the funny things.
I removed all other bodies, but the problem is still exisits. I removed all rendering & other methods, but no results.
The funny thing no2, that with newton 2.30 & jointlibrary 2.33 everything works fine.
Delfi:
These are my settings.
- Code: Select all
newtonworld:=NewtonCreate(nil,nil);
NewtonSetPlatformArchitecture(newtonworld,0);
NewtonSetSolverModel(newtonworld,1);
NewtonSetFrictionModel(newtonworld,1);
NewtonSetThreadsCount(newtonworld,2);
NewtonSetMultiThreadSolverOnSingleIsland(newtonworld,1);
Are they good or bad??
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by Julio Jerez » Mon Apr 25, 2011 8:27 am
version 2.24, to 2.33 are all teh same, teh only diffrence is that I re arrange the directory structure, fixed few bug and adde some const modofire to some funtion.
I have being working a l ot but that is on teh newt funtionality, teh collision stuff had not change since version 2.08 I beleive.
I did fix the crash error with optimization of tow faces, and I beleive it is in version 2.33
you should get version 2.33 and forget any older version.
cna you use teh debug libraries? maybe you can see where is crashing
or can you make a small binary that I can test?
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by collerblade » Mon Apr 25, 2011 8:42 am
Yes yes im already working on it. U will get a link in private message, if it is good.
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by collerblade » Mon Apr 25, 2011 9:07 am
Re,
I made u a demo:
http://www.collerblade.hu/demoversion.zip.
It is only a ground, from 2 triangles (treecollision), and a multibodycar with 4 wheels.
U can drive the car on the small ground, with up, down left right keys. Space is handbreak. F4 it for some car debug view. Also with R key u can reset the car.
In the packet there is 2 dll: newton.dll. (2.30) and newton_233.dll (2.33). Now there is a working demo. If u rename the newton_233.dll to newton.dll u can see my problem.
The car works the same, but the ground?? if u pres F4 i continuesly print the matrix of the ground. With 2.30 it is identity, with 2.33 it is different (The first float is usually -1.0).
I hope the bug isnt in my code
.
-
collerblade
-
- Posts: 88
- Joined: Mon Apr 05, 2010 12:09 pm
by Julio Jerez » Mon Apr 25, 2011 9:33 am
It crahes in thsoi function callback
void (*NewtonContactsProcess) (const NewtonJoint* const contact, dFloat timestep, int threadIndex);
that callback in call for thsio function
- Code: Select all
void dgWorld::ProcessContacts (dgCollidingPairCollector::dgPair* const pair, dgFloat32 timestep, dgInt32 threadIndex)
{
...
...
for (dgInt32 i = 0; i < count; i ++) {
dgGetUserLock();
list.Remove(nodes[i]);
dgReleasedUserLock();
}
if (material->m_contactPoint) {
// the funtion crashes here. if I commnet out thsi funtion i work fine
// ther fore your NewtonContactsProcess must have a bug
material->m_contactPoint(*contact, timestep, threadIndex);
}
...
}
}
can you post your funtion callback NewtonContactsProcess to see what it is?
when I cment teh callback it runn just like it did before..
I am guessing it is because in your callback you use this functions
- Code: Select all
NEWTON_API void NewtonMaterialGetContactForce (const NewtonMaterial* const material, dFloat* const force);
NEWTON_API void NewtonMaterialGetContactPositionAndNormal (const NewtonMaterial* const material, dFloat* const posit, dFloat* const normal);
NEWTON_API void NewtonMaterialGetContactTangentDirections (const NewtonMaterial* const material, dFloat* const dir0, dFloat* const dir1);
starting with 2.32 they now take the body that the half joint is attach too.
- Code: Select all
NEWTON_API void NewtonMaterialGetContactForce (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const force);
NEWTON_API void NewtonMaterialGetContactPositionAndNormal (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const posit, dFloat* const normal);
NEWTON_API void NewtonMaterialGetContactTangentDirections (const NewtonMaterial* const material, NewtonBody* const body, dFloat* const dir0, dFloat* const dir1);
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 2 guests