Heya all,
I've nearly cracked getting a heightmap terrain into a Newton body. In my code I'm definitely getting a physics hull of some kind, but it doesn't match up with the graphical equivalent. Now, a bit of poking around has lead me to believe that the call to getMeshBufferForLOD() doesn't return a correctly scaled mesh buffer, in fact whatever terrain scale values I throw at the addTerrainSceneNode() call, I still seem to get the same values in my SMeshBufferLightMap. Now, this isn't necessarily a problem, as I can just multiply the vertices by the scale values, but a combination of that and also any IrrToNewton scale values hasn't even got me close. Have I got the right end of the stick regarding what vertices I'm getting out of getMeshBufferForLOD()? How have other people done it? I'm thinking maybe Spintz or pfo might know something about this... onegai shimasu!
Almost there with Irrlicht/Newton terrain
-
- Posts: 98
- Joined: Mon Dec 13, 2004 11:47 am
- Location: Japan
NO problem is probably the position of the newto mesh. Just for exampel i tried the vertice part of the newton exampel (in the irrlicht tutorial section) and it was way of the real orientation and position. So i tried to play with it a little bit and got it to work by setting an offset matrix to the newton body. i used the center of the bounding box of the irrlicht body and applyed it as offset to the newton body...
But all this only applies when u use collision primitives and u are probably using collision trees to discribe the terrain but that works perfectly......at least in my case. so some more information about the problem would be good
But all this only applies when u use collision primitives and u are probably using collision trees to discribe the terrain but that works perfectly......at least in my case. so some more information about the problem would be good
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
Nick: you're right, the scale of the node is not returned with getMeshBufferForLOD() or getMesh(). You do need to get the scale from the node and apply it to all positions. I say this everytime: do not use IrrToNewton, that is not the correct way to apply scale in Newton. The only scale you should use is the scale of the terrain node, it should match up 100% all the time after that.
pfo: I really dont know if Newton will work well without IrrToNewton scale...
for myself, i have made a lot of tryouts to make a working vehicle, and only got it to work with this scale... If i understood well, its planned to be added on Newton API, and is described in NewtonGetGlobalScale section, on Newton docs. I guess it dependent on scale of your models/world. Ill look on forum for other comments about this.
for myself, i have made a lot of tryouts to make a working vehicle, and only got it to work with this scale... If i understood well, its planned to be added on Newton API, and is described in NewtonGetGlobalScale section, on Newton docs. I guess it dependent on scale of your models/world. Ill look on forum for other comments about this.
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
I think it works great... Last I checked more projects using Newton were not using some arbitrary scaling constant on all objects, and many of them look pretty good.pfo: I really dont know if Newton will work well without IrrToNewton scale
It is, Newton likes working with meters / kilograms / seconds. Getting objects sizes and masses to more closely resembly objects we would observe in real life will get better results.I guess it dependent on scale of your models/world
Yes, then we can say if your objects are larger or smaller in relation to real world, i believe you can use this scale factor to keep precision on results. I guess scalling isnt necessary if your models are sized correctly. Its specially true to vehicles. In my tests, i get weird results with my car before using scale factor ( IrrToNewton ). If i change this to 1.0f ( no scale at all ) my vehicle gets crazy, transform to a gynast, take a jump in the air and lands upside down .Newton likes working with meters / kilograms / seconds. Getting objects sizes and masses to more closely resembly objects we would observe in real life will get better results.
-
- Posts: 98
- Joined: Mon Dec 13, 2004 11:47 am
- Location: Japan
This is slightly off-topic but wasn't quite worth a whole new thread:
I've found a couple of things that may help people who are using Newton and Irrlicht in Visual Studio 2005 EE. I mentioned a while ago, just before 0.14 was released, that I was having some sort of weird crash when creating a collision tree using getMeshBufferForLOD(). If you bring up the project settings (project right click -> properties) and go into Configuration Properties > C/C++ > Code Generation, and set the runtime library to Multi-Threaded /MT, you get rid of that crash and also another nasty one where my program would crash on exit.
In the same menu, I've also had to set Enable C++ exceptions and Buffer Security Check to No, and also Basic Runtime Checks to default just to get it to compile and not complain about RTC calls. Does any of that sound scarily hacky to anyone or is part of programming these days just working out what to turn off?
I've found a couple of things that may help people who are using Newton and Irrlicht in Visual Studio 2005 EE. I mentioned a while ago, just before 0.14 was released, that I was having some sort of weird crash when creating a collision tree using getMeshBufferForLOD(). If you bring up the project settings (project right click -> properties) and go into Configuration Properties > C/C++ > Code Generation, and set the runtime library to Multi-Threaded /MT, you get rid of that crash and also another nasty one where my program would crash on exit.
In the same menu, I've also had to set Enable C++ exceptions and Buffer Security Check to No, and also Basic Runtime Checks to default just to get it to compile and not complain about RTC calls. Does any of that sound scarily hacky to anyone or is part of programming these days just working out what to turn off?
-
- Posts: 313
- Joined: Tue Nov 01, 2005 5:01 am