Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Newton terrain object did not accept to work good..

Author
Message
Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 21st Oct 2012 15:28 Edited at: 21st Oct 2012 15:34
Hi,
I made really BIG steps forward in Newton wrapper world.
I made a little demo where over 2000 little cubes are fired versus a wall and all works fine with great physics!
But I saw that my little cubes, after hitting the wall (thx to the gravity force), instead of falling on the ground and stop the movement ,they pierce and surpass the terrain (ground) object.

So finally I decided to make my terrain object as infinite mass object with collision tree too; as if it were a real terrain then I should see my cubes stop their fall when they hitting the terrain object.

Then I add the \"NDB_NewtonCreateTreeCollision\" command to have my terrain object with infinite mass (so unaffected from the force of the little cubes when these little cubes hitting the ground) and a collision system that know that the little cubes are exactly hitting the ground.

Now the DAMN WEIRD problem..:

When I use the \"NDB_NewtonCreateTreeCollision\", ALWAYS!, I get a windows application (APP CRASH) error as you can look at the posted image.

Ok at this point I trying ALL, 1 million of code changes but nothing.. ther error always appear if I using \"NDB_NewtonCreateTreeCollision\"..
So I reduced to maximum my code until I obtain the following really little code:




Result? Same damn ERROR!!
I trying to read from help files some info about the way to use \"NDB_NewtonCreateTreeCollision\" command so I find that I should to use the \"NDB_NewtonTreeCollisionBeginBuild\" and \"NDB_NewtonTreeCollisionEndBuild\" commands before and after I made my terrain...

So I try to make that code modification as the following:


But nothing.. I read from \"NDB_NewtonTreeCollisionBeginBuild\" command info the following :

Quote: "
Comments: This command tells Newton you are about to add faces (polygon data) to an empty Tree Collision object. To use this manual method you must have created an empty TreeCollision object by calling NDB_NewtonCreateTreeCollision with no parameters.
"


Where I have to put this "NDB_NewtonCreateTreeCollision with no parameters" ???.... I think I don't understand this info...

And sincerely, after other many attempts, I got nothing.. same my program crash a bit after I run it (before my terrain is showed)

Please... HELP!!!
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st Oct 2012 16:40
i believe you have to call at least one memblock command for that to work. Newton wrapper uses memblock internaly. Check the newton examples, they all have a non called memblock function on the bottom

Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 21st Oct 2012 18:37 Edited at: 21st Oct 2012 18:38
Quote: "i believe you have to call at least one memblock command for that to work. Newton wrapper uses memblock internaly. Check the newton examples, they all have a non called memblock function on the bottom
"


You are pretty right! In fact if I add the following code over the end of main loop I avoid the APP crash! THANK YOU!






PS:
Can someone teach me fast WHY these 2 code lines make my program to avoid the crash?
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 21st Oct 2012 19:17 Edited at: 21st Oct 2012 19:17
Quote: "Can someone teach me fast WHY these 2 code lines make my program to avoid the crash? "

newton wrapper internaly calls commands from dbpro's memblock dll. You have to use at least one command from it to force dbpro's compiler to include it in the exe

Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 21st Oct 2012 19:50
Thanks again!

Login to post a reply

Server time is: 2026-07-08 10:16:41
Your offset time is: 2026-07-08 10:16:41