OgreOde tutorials

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

OgreOde tutorials

Post by Cossins »

Hi!
Are there any OgreOde tutorials available? I managed to compile and make it actually work on Linux, but I don't really know where to go from here.

From the samples (which I can't get to run, but I can look at the code) I constructed a terrain geometry with a ninja (from the Ogre basic sample resources) falling down on it.

1) I set gravity to (0, -9.82, 0). 9.82 is the gravity acceleration around here, but nothing seems to actually accelerate. The movement seems linear.

2) For the ninja, I use BoxGeometry. This is very sub-optimal, is there a way to make OgreOde use the geometry of the mesh?

3) What units does OgreOde use for mass, force and volume? Kg, N and m^3? How much is 1 m i OgreOde in Ogre spatial units?

I'm REALLY missing an API reference here!!! Thanks for the help...

- Simon
AssiDragon
Greenskin
Posts: 145
Joined: Wed Apr 28, 2004 12:10 pm
Location: Hungary

Re: OgreOde tutorials

Post by AssiDragon »

Cossins wrote:Hi!
Are there any OgreOde tutorials available? I managed to compile and make it actually work on Linux, but I don't really know where to go from here.

From the samples (which I can't get to run, but I can look at the code) I constructed a terrain geometry with a ninja (from the Ogre basic sample resources) falling down on it.
Do the samples work, or things keep falling through there too? It may be a problem with your ODE, did you patch it alright?
Cossins wrote:1) I set gravity to (0, -9.82, 0). 9.82 is the gravity acceleration around here, but nothing seems to actually accelerate. The movement seems linear.
Probably the mass or the scale of the simulation tricks your eyes. :)
Cossins wrote:2) For the ninja, I use BoxGeometry. This is very sub-optimal, is there a way to make OgreOde use the geometry of the mesh?
You can make transformgeometries that will keep better to your ninja, or use ragdolls. Both are shown in the samples...
Cossins wrote:3) What units does OgreOde use for mass, force and volume? Kg, N and m^3? How much is 1 m i OgreOde in Ogre spatial units?
Please check ODE. It states they don't use any actual measure units - everything in ODE just works as a scale with which the physics engine can compare your objects. Say, this is 2x as heavy as the other. They don't work as actual units. You have make a standard scale and compare everything to that.
Hope is the first step on the road to disappointment.
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Re: OgreOde tutorials

Post by Cossins »

Thank you for replying!
AssiDragon wrote:
Cossins wrote:Hi!
Are there any OgreOde tutorials available? I managed to compile and make it actually work on Linux, but I don't really know where to go from here.

From the samples (which I can't get to run, but I can look at the code) I constructed a terrain geometry with a ninja (from the Ogre basic sample resources) falling down on it.
Do the samples work, or things keep falling through there too? It may be a problem with your ODE, did you patch it alright?
Yeah, it patched alright - the problem with the OgreOde samples is that they can't seem to get their resources right. I don't think it's a serious problem...
AssiDragon wrote:
Cossins wrote:1) I set gravity to (0, -9.82, 0). 9.82 is the gravity acceleration around here, but nothing seems to actually accelerate. The movement seems linear.
Probably the mass or the scale of the simulation tricks your eyes. :)
Maybe.
AssiDragon wrote:
Cossins wrote:2) For the ninja, I use BoxGeometry. This is very sub-optimal, is there a way to make OgreOde use the geometry of the mesh?
You can make transformgeometries that will keep better to your ninja, or use ragdolls. Both are shown in the samples...
I don't see any ragdoll samples in OgreOde/demos? Am I missing something here?
AssiDragon wrote:
Cossins wrote:3) What units does OgreOde use for mass, force and volume? Kg, N and m^3? How much is 1 m i OgreOde in Ogre spatial units?
Please check ODE. It states they don't use any actual measure units - everything in ODE just works as a scale with which the physics engine can compare your objects. Say, this is 2x as heavy as the other. They don't work as actual units. You have make a standard scale and compare everything to that.
Hm. But what about things like density, gravity and acceleration? What does m/s^2 mean in Ogre units?

- Simon
AssiDragon
Greenskin
Posts: 145
Joined: Wed Apr 28, 2004 12:10 pm
Location: Hungary

Re: OgreOde tutorials

Post by AssiDragon »

Cossins wrote:Yeah, it patched alright - the problem with the OgreOde samples is that they can't seem to get their resources right. I don't think it's a serious problem...
Well, it would be great if you could get it working - it would show if the problem is in your app's code or not. ;)
Cossins wrote:Maybe.
Gravity is handled by ODE, and I can assure you it works finely here. :)
Cossins wrote:I don't see any ragdoll samples in OgreOde/demos? Am I missing something here?
You certainly are. Didn't check simplescenes did you?
Cossins wrote:Hm. But what about things like density, gravity and acceleration? What does m/s^2 mean in Ogre units?
There is no such thing as Ogre units, as you can scale anything as you like - Ogre doesn't really care about the scales...
EDIT: About density, you can define the coulomb friction of collisions per collision... at least I did it that way. And I don't think you can do it otherwise as ODE has no material system I know of... someone correct me if I'm wrong perhaps?
Hope is the first step on the road to disappointment.
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Re: OgreOde tutorials

Post by Cossins »

AssiDragon wrote:There is no such thing as Ogre units, as you can scale anything as you like - Ogre doesn't really care about the scales...
Huh? That doesn't make sense. When you position an object on (0, 100, 300), how long would it take for an object with a certain mass at (0, 400, 300) to reach it with normal gravity acceleration? There must be some kind of unit system, or else physics as a whole doesn't make sense in Ogre space.

If I'm completely wrong, I would really like to know how OgreOde goes about being completely relative in all calculations regarding gravity and density/mass.

- Simon
koryspansel
Gnoblar
Posts: 13
Joined: Sat May 07, 2005 10:54 pm
Location: Eugene, Or

Post by koryspansel »

It all depends on what YOU define the units to mean. What does (0,400,300) mean to you? 400 meters above the y-axis and 300 meters positive the z-axis? If so the your scale is 1 unit = 1 meter. And if you are using SI system then you better keep your units the same (eg. meters, liters, kilograms, newtons, etc). I have not yet used Ode/OgreOde but if I had to guess I would say there is a way to set the acceleration due to gravity somehow.

Kory Spansel
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7

Post by haffax »

Eventhough not explicitly stated, you can just consider everything in SI units in ODE. 1 means 1 Meter for length 1 Kilogram for masses and 1 Newton for forces and 1 second for time. When you use these units it all works as expected. But you can scale it as you like, but you need to scale everything accordingly (namely the time steps). Also note, that ODE works best with values somewhere between 0.1 and 1.0, this is the nature of floating point numbers.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Post by Cossins »

tanis wrote:Eventhough not explicitly stated, you can just consider everything in SI units in ODE. 1 means 1 Meter for length 1 Kilogram for masses and 1 Newton for forces and 1 second for time. When you use these units it all works as expected. But you can scale it as you like, but you need to scale everything accordingly (namely the time steps). Also note, that ODE works best with values somewhere between 0.1 and 1.0, this is the nature of floating point numbers.
Thank you! That was what I needed to hear! :)

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

Post by monster »

tanis wrote:Eventhough not explicitly stated, you can just consider everything in SI units in ODE. 1 means 1 Meter for length 1 Kilogram for masses and 1 Newton for forces and 1 second for time. When you use these units it all works as expected. But you can scale it as you like, but you need to scale everything accordingly (namely the time steps). Also note, that ODE works best with values somewhere between 0.1 and 1.0, this is the nature of floating point numbers.
I hate to be pedantic, but there are two statements here that contradict each other here;

"you can just consider everything in SI units in ODE"
and
"Also note, that ODE works best with values somewhere between 0.1 and 1.0,"

And whilst they're both true, the second one's more true. So whilst you can just use SI units in ODE, that won't work if you've got very big objects in your scene, or very heavy objects. I think;

Seconds always make sense for the units of time.

If you've got a "normal" scene, people walking about the place, cars driving around, then meters make sense for the length unit. If your scene is very big (battleships or star-destroyers moving around) then you might want to make 1 ODE length unit = 100 meters, for example.

Scale your masses so that the biggest ratio between the heaviest and the ligtest is no more than 200 or so, less if possible. And those masses are in the 0.1 to 10 range. If you have very heavy things and very light things then make the very heavy things static.

Hope that makes sense.
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Post by Cossins »

monster wrote:Hope that makes sense.
It does, except for
monster wrote:If you have very heavy things and very light things then make the very heavy things static.
"static" meaning not handled by ODE? Or immovable?

- Simon
User avatar
SuprChikn
Bugbear
Posts: 863
Joined: Tue Apr 19, 2005 6:10 am
Location: Melbourne, Aus

Post by SuprChikn »

I think he means immovable. This way if their respective weights are very far appart, the light one will have an infintesimally small effect on the heavy one, so it's easier to not worry about it.
Plus it keeps your range of values that you have to worry about within a much nicer range.
User avatar
monster
OGRE Community Helper
OGRE Community Helper
Posts: 1098
Joined: Mon Sep 22, 2003 2:40 am
Location: Melbourne, Australia

Post by monster »

I think he means immovable. This way if their respective weights are very far appart, the light one will have an infintesimally small effect on the heavy one, so it's easier to not worry about it.
Exactly. Static as in; doesn't have a rigid body associated with it, so ODE doesn't move it around. For example, If you've got a basketball bouncing off a battleship then the battleship would just be static "world" geometry. Only the ball would have a physical body, so the battleship would still be collided with, it just wouldn't move.
User avatar
Chris Jones
Lich
Posts: 1742
Joined: Tue Apr 05, 2005 1:11 pm
Location: Gosport, South England
x 1

Post by Chris Jones »

sorry to be picky, i just had to, but gravity is 9.81 not 9.82 :D
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Post by Cossins »

Chris Jones wrote:sorry to be picky, i just had to, but gravity is 9.81 not 9.82 :D
Nope. Not at this longitude. :)

- Simon
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7

Post by haffax »

In Berlin it is about 9.807. Is it this different in Denmark?
And shouldn't it be depending more on the latitude instead of the longitude? ;)
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
Kentamanos
Minaton
Posts: 980
Joined: Sat Aug 07, 2004 12:08 am
Location: Dallas, TX

Post by Kentamanos »

tanis wrote:In Berlin it is about 9.807. Is it this different in Denmark?
And shouldn't it be depending more on the latitude instead of the longitude? ;)
I know we're getting off topic, but how would lattitude or longitude really affect it? Wouldn't it be more about altitude than those two?
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 7

Post by haffax »

Altitude doesn't matter too much, as long as you don't move away too far from earth. Standing on Mount Everest only takes away ca. 0.008 m/s² Whereas the difference between equator (around 9.78 m/s²) and north pole is much greater (around 9.83m/s²). This is because Earth is far away from being a sphere, it is more elliptic in its shape. So it is a question on where you got more earth directly under you. And Mount Everest with 8000 some meters is not much more than a small pimple on earth' face compared to its radius.
team-pantheon programmer
creators of Rastullahs Lockenpracht
Cossins
Gnoblar
Posts: 17
Joined: Sat May 07, 2005 9:50 am
Location: Denmark

Post by Cossins »

tanis wrote:In Berlin it is about 9.807. Is it this different in Denmark?
And shouldn't it be depending more on the latitude instead of the longitude? ;)
Well, it says 9.82 m/s^2 in our physics text books (that's what we've been using for the last three years). The numbers might be from North Sweden, but I doubt it makes much difference.

(and yes, we do know how to properly round numbers around here... :))

- Simon