
Open Physics Abstraction Layer sample app
-
- OGRE Retired Moderator
- Posts: 20570
- Joined: Thu Jan 22, 2004 10:13 am
- Location: Denmark
- x 179
No worries 

/* 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.
-
- Kobold
- Posts: 28
- Joined: Mon Jan 17, 2005 3:48 pm
- Location: Kenya
Great Work
I have just spent the whole day playing around with OPAl and having used ogreode and ogrenewt I have to say this is pretty good. Easy to set up, good peformance (I wount be blowing up any towers in my game).
Just a thought though, in 3dsmax, the Z axis points up. I exported a thin box primitive from max to act as a plane/ground and as expected it pointed up instead. Any body having this problem should change the box shape dimensions to reflect this.
Neat trick - lets say you have a car in max, set up the shapes in max to represent it and export the xml. Open up the xml in a text editor, copy the shape nodes from other solid nodes (including their transformation data) into one solid node. Delete the empty solid nodes.
In you code you can now iterate through the shapes and add them to a solid which you will use to represent your mesh.
I've only tried it once and it seems to work fine so test it out first.
I've found my physics engine and I'm sticking to it.
Just a thought though, in 3dsmax, the Z axis points up. I exported a thin box primitive from max to act as a plane/ground and as expected it pointed up instead. Any body having this problem should change the box shape dimensions to reflect this.
Neat trick - lets say you have a car in max, set up the shapes in max to represent it and export the xml. Open up the xml in a text editor, copy the shape nodes from other solid nodes (including their transformation data) into one solid node. Delete the empty solid nodes.
In you code you can now iterate through the shapes and add them to a solid which you will use to represent your mesh.
I've only tried it once and it seems to work fine so test it out first.
I've found my physics engine and I'm sticking to it.
-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
I'm tired and I want to go to sleep, so I cant be bothered reading the full 2+ pages of this thread.
Just a quck question about the demo: are the arms and legs of the "human" meant to be able to break off? Its just that while messing around with the demo, I couldnt help but smash the crap outta the guy with the log
In doing so, I found that I could get his arms and legs to go flying off into the void.
Just a quck question about the demo: are the arms and legs of the "human" meant to be able to break off? Its just that while messing around with the demo, I couldnt help but smash the crap outta the guy with the log

In doing so, I found that I could get his arms and legs to go flying off into the void.

-
- Kobold
- Posts: 28
- Joined: Mon Jan 17, 2005 3:48 pm
- Location: Kenya
Yes its a feature
The joints in OPAL can be set to be breakable or unbreakable.
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
-
- Gnoblar
- Posts: 24
- Joined: Thu Apr 21, 2005 7:23 pm
I had been getting notifed via email when people replied to this thread, but I think it stopped notifying me when the thread was moved. So I didn't think people were still posting. 

Just using SCons on Redhat 8 and Redhat Enterprise 3. Not sure what SCons uses internally. I've only ever used OPAL with ODE 0.5. By the way, currently OPAL uses ODE as a static library, so opal-ode.so/opal-ode.dll do not need an ODE dll/so at runtime.@ tylerstreeter: Could you describe what Linux environment OPAL has been tested on? automake, autoconf, ode versions and such would be helpful.
Sorry it's not working for you. I'm hoping someone else will come up with similar problems to help debug the problem. One thing I thought of: in your non-Ogre test app, you use the same variable name for 'pos' twice (once before the for loop, and once inside the for loop). This shouldn't be a problem on most compilers, but maybe it's giving yours trouble. Have you tried using a different name for the second Point3r?Personally, I don't get it. OgreRefApp works just fine (I just tried it), but OPAL has ODE NAN problems.
Not sure - I don't know much about it. I've only seen the pictures in that thread in the Showcase forum. Do you have more details about its features?Just a curious question - how does this differ with Moster's gangsta plugin?
Supposedly ODE is deterministic (and OPAL uses ODE, in case you didn't know). Lots of people have supposedly gotten repeatable results with ODE. Make sure you're either using world step (i.e. OPAL's highest Simulator accuracy level), or that you hack ODE to reset its random seed. See the ODE wiki for more details on this stuff.I swear to god, I'll rip out my ODE implementation from my engine RIGHT NOW if OPAL is deterministic.
I made the exporter maintain the same Y/Z direction as in Max. So, if in Max your box's 'up' direction is in the +Y direction, when you load it into OPAL, +Y will still be its 'up' direction.Just a thought though, in 3dsmax, the Z axis points up. I exported a thin box primitive from max to act as a plane/ground and as expected it pointed up instead. Any body having this problem should change the box shape dimensions to reflect this.
-
- Ogre Magi
- Posts: 1266
- Joined: Tue Aug 12, 2003 1:53 am
- Location: Melbourne, Australia
- x 1
just a small one, are there functions for creating simple auto physics bodies? The demos have a load of code for turning an ogre mesh into a physics body. Since 90% of time you'd be assigning simple primities could the 'makePhysical' (or whatever
) function just accept a primitive type and automatically get the bounding box parameters and assign everything? Would make the demo code look nicer 


-
- Gnoblar
- Posts: 24
- Joined: Thu Apr 21, 2005 7:23 pm
I'm not exactly sure what you mean. Do you mean taking a mesh and automatically generating the physical representation from its bounding box? In this demo I just used a couple of mesh files (sphere.mesh, box.mesh, etc.), and I scale them depending on what dimensions you pass to the createPhysicalEntity* functions, allowing me to generate a bunch of objects from a few mesh files. With the 'automatic physics generation' method, you would have to store a different mesh files for each size you needed. In 'real' scenarios (i.e. not simple demos), I guess you probably would have a different mesh for each object though. Also, it would be hard to determine the dimensions automatically for capsules just from the loaded mesh.just a small one, are there functions for creating simple auto physics bodies? The demos have a load of code for turning an ogre mesh into a physics body. Since 90% of time you'd be assigning simple primities could the 'makePhysical' (or whatever Wink ) function just accept a primitive type and automatically get the bounding box parameters and assign everything? Would make the demo code look nicer Smile
One sort of related idea (which could be added to OPAL eventually) is to take some arbitrary geometry (e.g. an Ogre mesh), put it into an octree of whatever depth you want, and generate physical box shapes from the filled octree nodes.
So, no, OPAL doesn't currently have any auto Solid generation (other than the 3ds max exporter, which generates/exports all the physical shapes from the visual geometry), but it could in the future. Seems like that would greatly streamline the workflow. Does that answer your question at all?

-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
I'm using GCC 3.4 to compile, so it does not cause any problems. (Thanks for nice ANSI support from open source compiler!) But just in case, I've tried using different names, and that does not resolve the problems.tylerstreeter wrote:Sorry it's not working for you. I'm hoping someone else will come up with similar problems to help debug the problem. One thing I thought of: in your non-Ogre test app, you use the same variable name for 'pos' twice (once before the for loop, and once inside the for loop). This shouldn't be a problem on most compilers, but maybe it's giving yours trouble. Have you tried using a different name for the second Point3r?Personally, I don't get it. OgreRefApp works just fine (I just tried it), but OPAL has ODE NAN problems.
Personally, I think that the problem comes from some float/double/etc. collision/overflows, who knows what, in the collision system in ODE. The reason I think so is because OgreRefApp works fine, and it uses its own collision generator.
Which brings me to an idea: Is it possible to replace OPAL collision system with OGRE's?
-
- Gnoblar
- Posts: 24
- Joined: Thu Apr 21, 2005 7:23 pm
Btw, OPAL's reals are typedef'd to float by default, and it's expecting ODE to also use floats for dReals. Are you using floats for everything?Personally, I think that the problem comes from some float/double/etc. collision/overflows, who knows what, in the collision system in ODE. The reason I think so is because OgreRefApp works fine, and it uses its own collision generator.
Not currently - OPAL uses ODE's collision detection exclusively. But maybe in the future.Which brings me to an idea: Is it possible to replace OPAL collision system with OGRE's?
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
Umm... Gentoo seems to compile ODE with doubles, so this could lead to troubles, although, I did try to remove ODE libs, and compile it myself with a single precision, but I was not trying forcefully to figure out if this could resolve the issues.tylerstreeter wrote:Btw, OPAL's reals are typedef'd to float by default, and it's expecting ODE to also use floats for dReals. Are you using floats for everything?
I will give it a try.
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
This is really quite a pitfall, I think you should make it clear somewhere in documentation that OPAL's real is float not a double, so that folks don't lose their time, trying to resolve this.
Here's the current output from my code that now uses correctly build ODE with SINGLE PRECISION, guys!
Gravity is (0, -9.81, 0)
Happy time!
Here's the current output from my code that now uses correctly build ODE with SINGLE PRECISION, guys!
Code: Select all
Before simulation: position: x: 0, y: 0, z: 0
--------------------------------------------------
Step: 0 solid: x: 0, y: -0.0409019, z: 0
Step: 1 solid: x: 0, y: -0.179071, z: 0
Step: 2 solid: x: 0, y: -0.413054, z: 0
Step: 3 solid: x: 0, y: -0.741421, z: 0
Step: 4 solid: x: 0, y: -1.16276, z: 0
Step: 5 solid: x: 0, y: -1.67569, z: 0
Step: 6 solid: x: 0, y: -2.27883, z: 0
Step: 7 solid: x: 0, y: -2.97084, z: 0
Step: 8 solid: x: 0, y: -3.75039, z: 0
Step: 9 solid: x: 0, y: -4.61618, z: 0

-
- Greenskin
- Posts: 132
- Joined: Mon Aug 02, 2004 7:40 am
- Location: Austin, Texas
This might be a bit premature in asking, but what is the next physics library that you are planning to include with Opal? Novodex, Newton etc... I put my vote in for Novodex as it has the PhysX coming out for it
Other than that, great work so far, can't wait to see the blender plugin and whatever you add next
And I think that you should create a forum on your website, as currently there is nowhere for a community to form (unless you don't want that, which would be silly).

Other than that, great work so far, can't wait to see the blender plugin and whatever you add next

And I think that you should create a forum on your website, as currently there is nowhere for a community to form (unless you don't want that, which would be silly).
-
- Gnoblar
- Posts: 24
- Joined: Thu Apr 21, 2005 7:23 pm
I'm glad to hear that things work now. Sorry for all the trouble. I've added a note to the build instructions in the readme file. Thanks for sticking with it!This is really quite a pitfall, I think you should make it clear somewhere in documentation that OPAL's real is float not a double, so that folks don't lose their time, trying to resolve this.
We'd like to stick with cross-platform physics engines. If Ageia decides to support more platforms than Win32 for Novodex, then maybe. Someone from Ageia told me at the GDC this year he had compiled it on Linux but didn't know if they would support it anytime soon.This might be a bit premature in asking, but what is the next physics library that you are planning to include with Opal? Novodex, Newton etc... I put my vote in for Novodex as it has the PhysX coming out for it Wink
The SourceForge forums are available: http://sourceforge.net/projects/opalAnd I think that you should create a forum on your website, as currently there is nowhere for a community to form (unless you don't want that, which would be silly).
-
- Gnoblar
- Posts: 24
- Joined: Thu Apr 21, 2005 7:23 pm
Scratch that. Olex has graciously offered to host an OPAL forum. Here's a link to the new forum:The SourceForge forums are available: http://sourceforge.net/projects/opal
http://www.speedacm.org/~o0lozi01/forum/index.php
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
No problem.tylerstreeter wrote:Scratch that. Olex has graciously offered to host an OPAL forum. Here's a link to the new forum:
http://www.speedacm.org/~o0lozi01/forum/index.php
-
- Gnoblar
- Posts: 6
- Joined: Mon Feb 21, 2005 10:12 pm
- Location: Vilnius, Lithuania
nice OPAL
Was looking yesterday for suitable physics abstraction layer for me to start learning physics and i came upon OPAL.
I liked it immediately, and made a cube fall down in less than two hours in my own project. That is good.
Especially i like that OPAL is easy to set up - just new simulator(); and create some solids, then simulate. in addition, easy to separate from the rest of the game.
Will be using OPAL further, so please develope it
Dark
I liked it immediately, and made a cube fall down in less than two hours in my own project. That is good.
Especially i like that OPAL is easy to set up - just new simulator(); and create some solids, then simulate. in addition, easy to separate from the rest of the game.
Will be using OPAL further, so please develope it

Dark
-
- Kobold
- Posts: 34
- Joined: Mon Apr 04, 2005 10:01 pm
This project looks really promesing, I've just had a look at it, and I must say I really like the way you've managed to bring simplicity to physics while maintaining extensive featuresets.
I've not yet had the time for a deep investigation; and I'm off to fairyland now, but I've got a quick question before I go:
Is it possible to do some collision (using your gravity) with a terrain scene? As I understand it so far, the collision engine works by colliding your own primitives with each other; which wouldn't allow for this. If so, would it be possible to access the collision engine and tell it about the collision after having done the collision checking yourself using Ogre's RaySceneQuerys?
Once more, nice work, and good luck on future development; I'd love to see this one reach a high.
I've not yet had the time for a deep investigation; and I'm off to fairyland now, but I've got a quick question before I go:
Is it possible to do some collision (using your gravity) with a terrain scene? As I understand it so far, the collision engine works by colliding your own primitives with each other; which wouldn't allow for this. If so, would it be possible to access the collision engine and tell it about the collision after having done the collision checking yourself using Ogre's RaySceneQuerys?
Once more, nice work, and good luck on future development; I'd love to see this one reach a high.
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA
You are not limited only to primitives. You can also use Mesh: see documentation here: http://opal.sourceforge.net/api/html/cl ... _data.html
I'm not sure about telling the engine about collisions. Although you could extend the simulator class and override what you need to change.
I'm not sure about telling the engine about collisions. Although you could extend the simulator class and override what you need to change.

-
- Kobold
- Posts: 34
- Joined: Mon Apr 04, 2005 10:01 pm
Hmm, so in theory, if I gave that the mesh of one of those tiles, it should be able to make physical objects collide with it?
Edit./
Hmm; everything's acting weird in Opal =P
And it's really getting on my nerves when things like:begin failing.. -_-
Edit./
Hmm; everything's acting weird in Opal =P
And it's really getting on my nerves when things like:
Code: Select all
physical->getSolid()->setEnabled(alive);
assert(physical->getSolid()->isEnabled() == alive);
-
- Kobold
- Posts: 34
- Joined: Mon Apr 04, 2005 10:01 pm
-
- Hobgoblin
- Posts: 593
- Joined: Fri Apr 08, 2005 6:08 pm
- Location: WA, USA