The OgreOde Thread

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Locked
User avatar
Falagard
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2060
Joined: Thu Feb 26, 2004 12:11 am
Location: Toronto, Canada
x 3
Contact:

Post by Falagard »

Goosey,

There are probably a lot of things you can do to speed things up, but it depends on how much time you have.

Is your city one big mesh file? Try breaking it up into multiple trimeshes. Can you represent your city for collision purposes as boxes instead of a trimesh? Do you know you'll be colliding with only objects within a certain zone? I think you can disable or remove bodies and geom from the physics simulation which will speed up the calculations.

Good luck,

Clay
User avatar
Goosey
Halfling
Posts: 88
Joined: Wed Sep 29, 2004 3:33 am
Location: Ohio, USA
Contact:

Post by Goosey »

Falagard wrote:There are probably a lot of things you can do to speed things up, but it depends on how much time you have.
About 1 week :) So not a lot.
Is your city one big mesh file? Try breaking it up into multiple trimeshes.
Multiple meshes, but all in one node that gets passed to the createstatictrimesh.. so all 1 big trimesh (right?)
Can you represent your city for collision purposes as boxes instead of a trimesh? Do you know you'll be colliding with only objects within a certain zone? I think you can disable or remove bodies and geom from the physics simulation which will speed up the calculations.
MMmmm good ideas. I think i will give a shot at breaking it into multiple nodes/multiple trimeshes. Then try to disable geoms that are not near the player (since it is the only thing i need to worry about colliding with).

One question: When you create a static trimesh, does it create both a body and geom, or just a geom?

(still wondering about why the polycount is getitng doubled too :|)
I <3 the OGRE Wiki, and SO SHOULD YOU! :)
Sanchez108
Gnoblar
Posts: 10
Joined: Thu Dec 02, 2004 9:03 pm
Location: West Chester, PA

General Collision question

Post by Sanchez108 »

Hi. I'm going to use OgreOde in a group project and I'm digging around in the code trying to get a feel for it before I begin the implementation, and I have a question. All references to code are from Monsters demo suite, Demo_SimpleScenes.

The collision function in the SimpleScenes class takes a contact point, but I can't find where this contact structure gets set, or even where SimpleScenes::collision is called. I assume that this is handled behind the scenes by virtue of the fact that SimpleScenes is registered with the world as a CollisionListener, but if that is the case, just what does that take care of?

If there's someplace I can go to read about this rather than have someone write an explanation, that'd be just as good. I've searched through the forums and haven't found anything about it so far.

Thanks for your help.

Alex Silverman
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Your CollisionListener takes the place of ODE's dNearCallback, so when you call "collide" on your world or on geometries or spaces the listener you have set will get called for every collision that happens. Just like with raw ODE. The supplied "steppers" that the demos use will take care of stepping the world and calling collide on the top level space, which will then cascade down the space hierarchy colliding everything in your world in pretty much the same way as the example code given in section 10.5 of the ODE manual. But you might not need to use the default steppers, in fact the idea would be that you would create your own specific to your application, the supplied ones are just examples.

Registering something as a collision listener is just the same as supplying a dNearCallback to one of ODE's collide functions, it just means that it allows you to be informed of any collisions that take place so you can set the properties of the collision (friction, etc) or ignore it entirely.

Like with the ODE callback, some of the information sent via the collision method is set for you (so you can decide what to do with the collision, e.g. ignore it) and some it expects you to set. Basically, if it's a "get" method (of Contact, e.g. getPosition) then it's something that's set for you before collision is called which you can look at to see whats involved in the collision and if it's a "set" method then it's some property of the collision which you might want to set, e.g. setCoulombFriction. This is explained in more detail in section 7.3.7 of the ODE manual, although the methods for setting the properties of the contact are slightly changed to (I hope!) make them easier to understand.

OgreOde will then automatically create the contact joints for you based on the properties you set in the Contact object.

Hope that makes sense!
Sanchez108
Gnoblar
Posts: 10
Joined: Thu Dec 02, 2004 9:03 pm
Location: West Chester, PA

Post by Sanchez108 »

Ok. I believe I understand it now. I'll work at it and if anything else comes up, be sure I'll be back :)

Thanks Monster.
apanjocko
Gnoblar
Posts: 3
Joined: Thu Nov 18, 2004 3:31 pm

Post by apanjocko »

thanks monster for the effort, it's really nice and the code is easy to read and understand. i really hope you continue this and include things you have discussed such as .physics files etc. excellent work.
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

I wanted to ask if there's a version around, with a more implemented Vehicle file. Don't get me wrong, there's nothing bad about the file, but there are many methods not yet implemented (the whole gear stuff and so on). I'm just asking if someone made a racing game and already implemnted them. The reason why I'm asking is, that I want to TRY to programm a small car game.
Perhaps I missed something, but I haven't seen a possibility how to increase the speed of the vehicle or reversing (I hope this is the correct word, sorry about my bad english; I mean driving backwards). If there's already a simple solution for this and I missed it, please tell me and ignore the post :lol:

Thanks to monster for making ogreode, it's simply great. I've never done anyything with a phyic engine and I managed to to let a ball bounce arount....
and a car drive :) at least a little
User avatar
Bren
Goblin
Posts: 215
Joined: Tue Jul 08, 2003 4:41 pm
Location: 0,0,0
Contact:

Post by Bren »

Where can I get the current version of OgreOde? I looked at the first message in this thread, and it tells me where to get the Preview version. Obviously very old.

That "first message to link" idea is great, but needs to be updated.

I'm getting the String::BLANK building with Ogre 15.1 for the first time. I'm hoping current OgreOde solves that. I still have an old OgreOde_Setup.exe that I got from somewhere, but can't remember where. Is there a permanent home for the current one? The readme says nothing really. It would be great if it said where to get the current version.

I could go to CVS but I much prefer working with Stable code.

BTW The search function sucks. Searching for anything related to OgreODE always coughs up this thread, and that's it, and it's now like 17 pages or something. Not really helpful.

EDIT: I grabbed it from the ogreaddons snapshot, which makes me kinda nervous, but what the hey.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

I wanted to ask if there's a version around, with a more implemented Vehicle file.
Nope, sorry. As you've said there's lots of methods there that need to be filled in to complete the Vehicle simulation module. What's there is just what I thought might be a reasonable interface for the module, but I've not had a chance to "fill in the blanks" myself. There are some hooks missing though, like a way to simulate a decent tyre model, or an analogue clutch, etc, etc.

I'm sure if someone would like to fill in these missing pieces then everyone else would be very grateful! The Motorsport guys (http://motorsport-sim.org/) seem to be coming up with some very nice stuff, you might look to there for inspriation, and also at Racer (http://www.racer.nl/).
Where can I get the current version of OgreOde?
I think what's in CVS pretty much is the latest stable version (in so far as it can be considered stable) which is basically the Preview version with a few bug fixes. I only update CVS very occasionally, and hopefully only from a relatively stable version from my hard drive.

Bear in mind though that "stable" is a relative term, this is effectively pre-production code which I don't work on as often as I should/could and is therefore nowhere near as stable as (for example) the core Ogre code.

Caveat emptor!
shul
Gnoblar
Posts: 24
Joined: Sat Sep 11, 2004 9:49 am

Post by shul »

Hi monster, what's up?

You say the stable version is in CVS... ehmm.. what CVS? I synched with "ogrenew" CVS and there is no OgreODE anywhere..

(this is probably written somewhere within the 17 pages long thread)

How can I get OgreODE through CVS?

Thanks,
Shul
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

It's there. You want the ogreaddons bit, not the ogrenew bit. Or just get the addons nightly snapshot.

Oh, and "stable" is a relative term!
;)
shul
Gnoblar
Posts: 24
Joined: Sat Sep 11, 2004 9:49 am

Post by shul »

OK, got it... thnx

Is there a linux build somewhere? I can't find it...
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Cool. No there's not a Linux build in CVS, someone did send me some makefiles but I've not had a chance to look at them yet. Basically you just need to compile everything and link to ODE, there shouldn't be any fancy setup needed I think.
shul
Gnoblar
Posts: 24
Joined: Sat Sep 11, 2004 9:49 am

Post by shul »

Hiall

Did anyone got the samlpes for ogreode CVS working under linux ?

thnx
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

I have a question/problem concerning the landscapes demo. When running it the car drives "through" the green hill.

I thought, maybe a problem with the landscape.cfg. So I reaplaced it with the terrain.cfg from the ogre examples (use in the terrain demo). Same problem. The car doesn't only drive through the hills it also seems to fly at the lower parts, I mean drive on an invisible plane.

I think that's not what's intended by the demo. Has anyone an idea what could be the problem or how I can fix this?
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7
Contact:

Post by haffax »

Is this the third or fourth time this question was asked? Can't count it anymore. ;)
Yes, this thread is quite long and hard to read. You have to use Monsters patched version of ODE. The patch is somewhere below ogreaddons/ogreode.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX
Contact:

Post by temas »

Maybe it's about time to lock this thread?
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Maybe it's about time to lock this thread?
Fine by me!
Is this the third or fourth time this question was asked? Can't count it anymore.
I think it's about the 4 millionth time. And, as always, the answer's there if people actually bothered to read the readme files. I didn't just include them for typing practice you know!
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

Sorry, must have missed this...
Didn't intented to get on your nerves....
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

Now I read all the readme files (hope I didn't miss again anything) but now I've got the following compilation problem with ode: in collission_kernel.cpp of ode I get the following error: dTerrainCallback: identifier not found (it's the part where I added all those setCollider(....) ).
And in collision_trimesh.cpp there is the identifier g undeclared in the #ifdef dTRIMESH_ENABLED. Now I've been playing around with this the whole day an honestly I don't know what to do now. I'm sure it's a stupid beginner error but I'm not abler to fix it. :(

Would it be possible that someon could zip his whole ogreode folder and sent it to me via e-mail or publish it on a ftp. That would be a great help.

My Mail: charlie.babittATgmx.at

PLEASE!!! :oops:
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

Can you post the actual compilation errors you get. I can only assume you've followed one of the steps incorrectly and I apologise if the documentation is unclear.

For starters, you shouldn't have done anything to collision_trimesh.cpp so I can't understand why that's giving you errors.

Secondly, in collision_kernel.cpp, step 5 of the instructions asks you to add lines with the text dTerrainCallbackClass and dCollideTerrainCallback, I don't believe that there's anywhere that you're asked to add anything that says dTerrainCallback. You add the function prototype for dCollideTerrainCallback to collision_std.h (step 6) and the value for dTerrainCallbackClass to the enum in collision.h (step 2).

Hope that makes sense.

What's in CVS (or the snapshot thereof) effectively is my OgreOde folder zipped up. I'm pretty sure that the instructions are correct because I'm sure more people would have whinged if they were wrong, plus I use them myself whenever I upgrade my Ogre installation and have to re-compile OgreOde!

Alternatively there's a patch (created by sinbad, ta!) to make these changes to your ODE installation automatically. I've never tried it, but it should be there in CVS I think.

[edit]
Actually, it's not in CVS, but you can get it here;
http://www.green-eyed-monster.com/ode-05-ogreode.patch
Note that you still need to manually copy across the new dTerrainCallback.cpp file.
[/edit]
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

Thanks for the patch monster....
Worked!!

Now I'm driving on the hills and not through the hills.....

As the others already said, great work...
User avatar
charlie
Greenskin
Posts: 146
Joined: Mon Nov 15, 2004 1:43 pm
Location: Austria
Contact:

Post by charlie »

Again I have a question.
Concerning the landscape demo.
For playing around I wanted to add some objects to the scene. Worked great but I wanted the y coordinate to be calculated by the "system" and not write it hardcoded. So I tried (at the buttom of the createScene(...) method) the command:

Code: Select all

test_position.y=heightAt(test_position);
The method heightAt is decalred in the same file and I suppose this should be the way to get the height at a position.
The Vector3 test_position was initiated with a position which I'm sure is above the terrain (but I also tried an initial position beyond the terrain.

But however my test_position.y always returns 0. Which is definitly beyond the terrain!!! I tried several config files, but still the problem stays.
Would be great if someone has an idea and could help.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia
Contact:

Post by monster »

the scene needs to have been rendered once before the ray query will work, do it in frame ended not create scene
User avatar
temas
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 390
Joined: Sun Oct 06, 2002 11:19 pm
Location: The Woodlands, TX
Contact:

Post by temas »

********* LOCKED *********

This thread is huge and cumbersome, and awfully repetitive now. Search first! If you still have a question, post a new thread.
Locked