Newton Tutorial
Newton Tutorial
Hey all,
well, after trying to geht the newton physics engine to work with the irrlicht engine (v.0.14) i give up.
Maybe someone has a suggestion what is wrong.
I can load the application, but instead of having multiple boxes and instead of being able to create new boxes I can only see one.
Debugging the code shows me, that the coordinates of all the boxes created in the beginning are correct, even the setTranslation function seems to be called correctly.
But, there ist still just one box in the middle, nothing else...
I tried to get it working for several hours now, but I have no clue what is going wrong...
(i'm using the example code downloaded from the tutorial. the binaries work fine of course, but the compiled code doesnt)
using .net2003
well, after trying to geht the newton physics engine to work with the irrlicht engine (v.0.14) i give up.
Maybe someone has a suggestion what is wrong.
I can load the application, but instead of having multiple boxes and instead of being able to create new boxes I can only see one.
Debugging the code shows me, that the coordinates of all the boxes created in the beginning are correct, even the setTranslation function seems to be called correctly.
But, there ist still just one box in the middle, nothing else...
I tried to get it working for several hours now, but I have no clue what is going wrong...
(i'm using the example code downloaded from the tutorial. the binaries work fine of course, but the compiled code doesnt)
using .net2003
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
No, don't give up!well, after trying to geht the newton physics engine to work with the irrlicht engine (v.0.14) i give up.
Some guesses: you aren't calling NewtonUpdate, or you are calling it with an improper timestep. Try setting the NewtonWorld size to something really big. Everything outside of the default size is disabled by Newton, it defaults to something like 10x10x10 units. Also, things might not be moving because you didn't set their transform callback up correctly, or force and torque callback.instead of having multiple boxes and instead of being able to create new boxes I can only see one.
Have look at Mercior demo.
http://newtondynamics.com/downloads.html
http://newtondynamics.com/downloads/MerciorDemo.zip
It shows pretty much everything you have to do to implant some basic (like hinges, boxes, ragdolls e.t.c)newton functions in your project witch is made in irrlicht .
http://newtondynamics.com/downloads.html
http://newtondynamics.com/downloads/MerciorDemo.zip
It shows pretty much everything you have to do to implant some basic (like hinges, boxes, ragdolls e.t.c)newton functions in your project witch is made in irrlicht .
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
http://irrforge.org/index.php/Simple_Ne ... ht_Example
very bare bones demo of newton -irrlicht uses resources from the irrlicht sdk.
very bare bones demo of newton -irrlicht uses resources from the irrlicht sdk.
Oh I wont... But its a time question wether we will be able to use the physics engine or if we have to use a simplified physics system for our project...No, don't give up!
Hmm, the strange thing is, this is the Mercior Demo Code! In the beginning I implemented everything into the Project. That didnt work, then I extracted more and more ending up just having the mercior demo code, but that code should work! Thats what confused me...
Even if I download and compile it, same behaviour, I have the feeling that I missed something very easy but I dont know what...
I'll have a look at the last newton irrlicht example, thanks for that.
- White Box Entertainment -
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
Post the relevant parts of your code. Where do you initialise the box positions in irrlicht and in newton. What does your force callback look like and what your translation callback. Please also post parts that otherwise affect their transformation on screen.
Did you try to enable debug line view of your Newton collisions? If so, are those placed correctly? Also of interest: What NewtonSDK-Version do you use?
Did you try to enable debug line view of your Newton collisions? If so, are those placed correctly? Also of interest: What NewtonSDK-Version do you use?
I uploaded the small example and postet the link further up in this thread.Post the relevant parts of your code.
The strange thing is, it is similar to the mercior code example. Even if I use exactly that example it doesnt work and the same as explaned above happens...
I use Irrlicht 0.14 and Newton 1.5
- White Box Entertainment -
I am studing this sample but I think there is a bug heredhenton9000 wrote:http://irrforge.org/index.php/Simple_Ne ... ht_Example
very bare bones demo of newton -irrlicht uses resources from the irrlicht sdk.
Code: Select all
// set the newton world size based on the bsp size
float boxP0[3];
float boxP1[3];
float matrix[4][4];
matrix4 mmm;
mmm.setTranslation(vector3df(-1370,-130,-1400)*IrrToNewton);
NewtonBodySetMatrix(nmapbody,&mmm.M[0]);
NewtonCollisionCalculateAABB (nmapcollision, &matrix[0][0], &boxP0[0], &boxP1[0]);
NewtonSetWorldSize (nWorld, (float*)boxP0, (float*)boxP1);
Matrix is never initilized before it is passed to the funtion NewtonCollisionCalculateAABB, or am I missing something
Last edited by cassini on Wed Feb 01, 2006 5:52 pm, edited 1 time in total.
-
- Posts: 395
- Joined: Fri Apr 08, 2005 8:46 pm
Darkwolf, Replace this line in your code
with something like this
The way you have it, you are passing in NULL for the event receiver. With this code in place the receiver works like a charm
cassini ---
hmm, that doesn't sound good, must mean theit isn't used anywhere . Its filled out by the NewtonCollisionCalculateAABB, but it would be a good idea to iniitalize it,given that this is C++
Code: Select all
device = createDevice(EDT_OPENGL, dimension2d<s32>(800,600), 16, false, true, this);
with something like this
Code: Select all
device = createDevice(EDT_OPENGL,
dimension2d<s32>(640,480), 16,false,true,false,this);
cassini ---
hmm, that doesn't sound good, must mean theit isn't used anywhere . Its filled out by the NewtonCollisionCalculateAABB, but it would be a good idea to iniitalize it,given that this is C++
-
- Posts: 377
- Joined: Fri Oct 28, 2005 10:28 am
- Contact:
I debugged it too and the problem is, that you place all the boxes outside your World dimensions. A y value of 500.0f is well outside your NewtonWorldSize and thus neither transform nor force callback are ever called.
Set it to say 100 and it works fine.
This worked for me:
Set it to say 100 and it works fine.
This worked for me:
Code: Select all
MakeCube(vector3df((float)(x*100)-xo, 100.0f, (float)(y*100)-yo)
That works perfectlydevice = createDevice(EDT_OPENGL,
dimension2d<s32>(640,480), 16,false,true,false,this);
MakeCube(vector3df((float)(x*100)-xo, 100.0f, (float)(y*100)-yo)
Just found that out as well.
I still wonder though, because this is how the code in the example looked like.
In any way, thanks alot for your help! Now we finally can start implementing the physics engine into our project.
In a few month time we should be able to present the first prototype of our game. (its going to be a 3D platform jump and run - it is one of our projects during our games tech course)
darkwolf
- White Box Entertainment -