Look! Some falling boxes! Part Deux!
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
Look! Some falling boxes! Part Deux!
I've made several improvements to the Nogredex framework so I thought this was worthy of a new thread.
* It works with Ogre 1.0.1!
* Better simulation reset support! Just call mNogredex->init() and everything is destroyed and re-initialized correctly.
* Load any mesh you want! Ogre meshes can now be physically simulated as either a box, capsule, or a triangle mesh.
Notes:
If you try out your own mesh and attempt to simulate it as a triangle mesh make sure that it is a CLOSED mesh. Novodex will return NULL when the actor is created if the mesh isn't closed... or simply crash.
Limitations (Bugs):
Meshes simulated as triangle meshes are limited to 64k indices or less, which means you can't have more than 64k/3 faces. Yes, this is probably a good thing. No, the code doesn't check this for you.
Meshes simulated as triangle meshes that have more than one sub-mesh aren't supported.
Download: here
I would greatly appreciate comments/feedback/code review.
-robert
robertwrose.com
Last edited by gfm on Wed Apr 20, 2005 4:59 pm, edited 1 time in total.
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
You should register as a developer @ sourceforge.net, if you're not already. Then give your sourceforge username to the Ogre team - and wait for you to get dev access to your corner of the ogreaddons.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
- Telamon
- Kobold
- Posts: 26
- Joined: Mon Feb 28, 2005 9:34 am
- x 1
- Contact:
I'm a huge fan of your first nogredex demos! Trimesh support is very exciting, though the limit on indices is kind of a downer since it prevents me from being able to do collision detection against any terrain larger than 256x256.
Anyways, I had two problems running this demo:
First, I didn't have d3dx9_24.dll (found it online someplace)
Second, it fails during startup. Here's the ogre log:
12:38:43: Parsing script sample.fontdef
12:38:43: Bad attribute line: glyph 0.152344 0.125 0.160156 0.1875 in font Ogre
I plan to look at the code and try to figure it out once I first some of my more mundane classwork (MIPS asm anyone?)
Anyways, I had two problems running this demo:
First, I didn't have d3dx9_24.dll (found it online someplace)
Second, it fails during startup. Here's the ogre log:
12:38:43: Parsing script sample.fontdef
12:38:43: Bad attribute line: glyph 0.152344 0.125 0.160156 0.1875 in font Ogre
I plan to look at the code and try to figure it out once I first some of my more mundane classwork (MIPS asm anyone?)
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
Ah. Yeah this was built on a system with the DirectX 9.0 Feb 2005 SDK installed. If you don't have that version of the SDK installed you'll get that error. Just rebuild it and you shouldn't have any problems. I shouldn't have released the executable so folks are tempted to just run it.Telamon wrote: First, I didn't have d3dx9_24.dll (found it online someplace)
Second, it fails during startup. Here's the ogre log:
12:38:43: Parsing script sample.fontdef
12:38:43: Bad attribute line: glyph 0.152344 0.125 0.160156 0.1875 in font Ogre
I plan to look at the code and try to figure it out once I first some of my more mundane classwork (MIPS asm anyone?)
The fontdef thing I have no idea. You've got Ogre 1.0.1 installed, right?
- batonrye
- Halfling
- Posts: 52
- Joined: Sun Apr 17, 2005 8:37 pm
- Location: Michigan, US
- Contact:
Well, you could set up a quad tree system where the terrain is subdivided into smaller quadrants, each individual trimeshes, and only the possibly effected sections (within a distance of an object) are considered for collisions.Telemon wrote:the limit on indices is kind of a downer since it prevents me from being able to do collision detection against any terrain larger than 256x256
Jared
http://batonrye.com
http://batonrye.com
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
I believe the index limitation is artificially imposed by my code. I gather the triangles of the ogre mesh by stepping through the hardware buffers ogre stores to represent these structures. When I grab the index buffer I'm smashing it to an unsigned short pointer. I know that ogre supports 32 bit index structures, but I'm not sure how to query this. Someone want to take a stab at it?batonrye wrote:Well, you could set up a quad tree system where the terrain is subdivided into smaller quadrants, each individual trimeshes, and only the possibly effected sections (within a distance of an object) are considered for collisions.Telemon wrote:the limit on indices is kind of a downer since it prevents me from being able to do collision detection against any terrain larger than 256x256
-
- Halfling
- Posts: 45
- Joined: Thu Mar 24, 2005 5:49 am
- Location: Australia
Sensational work!!!
That's great work gfm
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
Updates!
Thanks to Sinbad, Nogredex is now an OgreAddon. The latest source for Nogredex is now in the Ogre Sorceforge CVS repository.
I've also uploaded a stand-alone demo of Nogredex to my website, you can get it here.
I've removed the 16 bit index limitation on meshes. You should now be able to load any size mesh you want. (I wouldn't recommend it tho, in my testing I found that Novodex starts to bog down on meshes larger than 10,000 triangles).
Meshes with more than one sub-mesh are now fully supported and correctly simulated. I've also added some optional code that will even optimize these types of meshes by removing duplicate vertices.
Enjoy!
-robert
robertwrose.com
Thanks to Sinbad, Nogredex is now an OgreAddon. The latest source for Nogredex is now in the Ogre Sorceforge CVS repository.
I've also uploaded a stand-alone demo of Nogredex to my website, you can get it here.
I've removed the 16 bit index limitation on meshes. You should now be able to load any size mesh you want. (I wouldn't recommend it tho, in my testing I found that Novodex starts to bog down on meshes larger than 10,000 triangles).
Meshes with more than one sub-mesh are now fully supported and correctly simulated. I've also added some optional code that will even optimize these types of meshes by removing duplicate vertices.
Enjoy!
-robert
robertwrose.com
- gfm
- Gnoblar
- Posts: 17
- Joined: Mon Oct 11, 2004 7:05 am
- Location: Oregon
- Contact:
Re: Closed?
If you want to physically simulate a mesh, it needs to have certain characteristics. I don't know exactly what they are, but I've found that non-closed meshes and large disjoint meshes sometimes cause failures in Novodex.Emil wrote:Then how do i close a mesh?If you try out your own mesh and attempt to simulate it as a triangle mesh make sure that it is a CLOSED mesh. Novodex will return NULL when the actor is created if the mesh isn't closed... or simply crash.
A "closed" mesh is simply a mesh with no holes. Some non-closed meshes I've experimented with seem to work fine with Novodex, others don't. I don't understand the rules, but I know that if your mesh is closed you won't have any problems.
A "disjoint" mesh (I can't think of a better name) is a mesh where you can't connect the dots between all of the vertices. This means there are pieces of the mesh that don't connect with other pieces. Again, I've had success getting some of these meshes to work, but then others don't.. I don't understand the rules, so just don't make disjoint meshes.
I think the reasons for these failures probably has something to do with calculating the mass and inertial tensor for the mesh. For instance, if there's a gaping hole in the mesh, do you fill it, or do you leave the object hollow? The choice you make will substantially effect the inertial tensor of the created object. I experimented with a few meshes that weren't closed and the results were just plain wacky--you throw the object up in the air with a topspin and it did not at all appear to conserve energy.
- Shtong
- Gnoblar
- Posts: 23
- Joined: Sat Apr 23, 2005 1:46 pm
- Location: Paris, France
Man, I was trying for 3 weeks to make a BspLevel mod who creates a trimesh for Novodex to make terrain collisions. Your addMesh function was a great helper to me. Thanks !
I've done the bigger part now, geometry is correctly defined and everything works fine, except that it's a bit laggy with more than 5 objects even in the Ogre's demo BSP map. I'm now looking for some way to rise the framerate up (maybe create one actor per node and activate only objects into visible nodes ?)
Keep up good work
I've done the bigger part now, geometry is correctly defined and everything works fine, except that it's a bit laggy with more than 5 objects even in the Ogre's demo BSP map. I'm now looking for some way to rise the framerate up (maybe create one actor per node and activate only objects into visible nodes ?)
Keep up good work
- darkmaster
- Halfling
- Posts: 67
- Joined: Wed Mar 09, 2005 7:04 pm
- Location: Netherland
Hello, how bout the world metric used inside Novodex.
Is the world metrix used by Novodex also same with Ogre??
For example, If I make a box with dimension 0.5,0.5,0.5
would it be same if I scale a sceneNode by tht value also??
And what is the minimum number of vertice per mesh in Novodex? I think the normal amount is 3 isn't it??
or 4??(startPoint -> point1 ->point2 ->startagain)
THanks,
Dark
Is the world metrix used by Novodex also same with Ogre??
For example, If I make a box with dimension 0.5,0.5,0.5
would it be same if I scale a sceneNode by tht value also??
And what is the minimum number of vertice per mesh in Novodex? I think the normal amount is 3 isn't it??
or 4??(startPoint -> point1 ->point2 ->startagain)
THanks,
Dark
Engineers aren't boring people, but they got excited over boring things and they make it fun.
www.freewebs.com/gpkfontys
www.freewebs.com/gpkfontys
- darkmaster
- Halfling
- Posts: 67
- Joined: Wed Mar 09, 2005 7:04 pm
- Location: Netherland
Great, thanks for the answer
Dark
Dark
Engineers aren't boring people, but they got excited over boring things and they make it fun.
www.freewebs.com/gpkfontys
www.freewebs.com/gpkfontys
- darkmaster
- Halfling
- Posts: 67
- Joined: Wed Mar 09, 2005 7:04 pm
- Location: Netherland
Yes it would be. Basically, Nogredex is just Novodex made with Ogre for the graphical things. All the physic things is pure Novodex
Dark
Dark
Engineers aren't boring people, but they got excited over boring things and they make it fun.
www.freewebs.com/gpkfontys
www.freewebs.com/gpkfontys
-
- Halfling
- Posts: 64
- Joined: Thu Jul 29, 2004 6:30 pm
I am so completely lost...
The project setup for this addon is really boggling my mind. I have my standard Ogre setup that works well, so I set one of those up and copied all the code from Nogredex into that project, added the right links to Novodex and compile just fine, but when I run, an exception hits here:
To even get this far, I had to rename the 'copy of NogredexDemoFrameListener.h' file to 'NogredexDemoFrameListener.h'.
I downloaded this from gfm's site? Is that the wrong place to get it? Should I go to the CVS instead? Will it make any difference? Help!
- Wraith
The project setup for this addon is really boggling my mind. I have my standard Ogre setup that works well, so I set one of those up and copied all the code from Nogredex into that project, added the right links to Novodex and compile just fine, but when I run, an exception hits here:
Code: Select all
Overlay* o = (Overlay*) OverlayManager::getSingleton().getByName("Nogredex/Cursor");
if (!o)
Ogre::Exception( Exception::ERR_ITEM_NOT_FOUND, "Could not find overlay Nogredex/Cursor", "NogredexDemoFrameListener" );
o->show();
mCursor = o->getChild("Nogredex/CursorPanel");
I downloaded this from gfm's site? Is that the wrong place to get it? Should I go to the CVS instead? Will it make any difference? Help!
- Wraith
- jacmoe
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
- Contact:
You could start by making sure that the app has all the media it needs - i.e. copy it to the media dir you are using.
I compiled it alright, but I was using the ogreaddons one.
I compiled it alright, but I was using the ogreaddons one.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
-
- Halfling
- Posts: 64
- Joined: Thu Jul 29, 2004 6:30 pm
-
- Halfling
- Posts: 64
- Joined: Thu Jul 29, 2004 6:30 pm
It was all in the project settings for my default project vs the nogredex one. Its all good now. Thanks for trying, and to the community thanks for Nogredex!
BTW... BigHugeGames announced recently that their new RTS (Rise of Legends) will support the Physics chip and they are using... Novodex.
- Wraith
BTW... BigHugeGames announced recently that their new RTS (Rise of Legends) will support the Physics chip and they are using... Novodex.
- Wraith
-
- Halfling
- Posts: 64
- Joined: Thu Jul 29, 2004 6:30 pm
My next big hurdle is to get Nogredex and the Terrain Scene Manager talking and to make a mesh object for Nogredex for the terrain. Something like addTerrain() that reads in the terrain from the scene manager and builds the Novodex mesh from it.
Seems pretty straight forward according to the Novodex docs. Need to just create a mesh and set up the meshdesc with a couple extra fields.
Now I gotta research the Terrain Scene Manager and figure out how to read out the y value for any x,z value. Also reading from the manager the number of vertices and faces would be helpful in setting up the Novodex mesh object.
For anyone who tries to do this in the future (in case I fail) the nogrodex addon demo project has some of the plugins disabled, spent an hour chasing my tail trying to figure out why things were bombing, cause it was defaulting to the generic scene manager, and the terrain loading function was (of course) not support by that scene manager.
If I actually accomplish this, I'll be more than happy to share the code.
- Wraithdrit
Seems pretty straight forward according to the Novodex docs. Need to just create a mesh and set up the meshdesc with a couple extra fields.
Now I gotta research the Terrain Scene Manager and figure out how to read out the y value for any x,z value. Also reading from the manager the number of vertices and faces would be helpful in setting up the Novodex mesh object.
For anyone who tries to do this in the future (in case I fail) the nogrodex addon demo project has some of the plugins disabled, spent an hour chasing my tail trying to figure out why things were bombing, cause it was defaulting to the generic scene manager, and the terrain loading function was (of course) not support by that scene manager.
If I actually accomplish this, I'll be more than happy to share the code.
- Wraithdrit