And another one! Physics engine, that is!
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
Wow, lots of people integrating Newton into their projects
about the slowdown: you essentially have a stack of 300 boxes there... that's an extremely taxing thing to compute! Newton has a different solver than other engines. it doesn't have any "shortcuts". anyway, that means that it's not particurlary fast at calculating large stacks of objects, which are basically just used in demos anyway.. you wouldn't want something like that in a game enviornment anyway, considering you'd also have more graphics, AI, etc.
about the slowdown: you essentially have a stack of 300 boxes there... that's an extremely taxing thing to compute! Newton has a different solver than other engines. it doesn't have any "shortcuts". anyway, that means that it's not particurlary fast at calculating large stacks of objects, which are basically just used in demos anyway.. you wouldn't want something like that in a game enviornment anyway, considering you'd also have more graphics, AI, etc.
- :wumpus:
- OGRE Retired Team Member
- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
-
- Gnoblar
- Posts: 24
- Joined: Fri Sep 03, 2004 1:29 pm
- Location: Italy
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
look at the Newton samples, there is an example of a heightmap-based collision that doesn't use TreeCollisions. it's very fast, and takes basically no extra memory, whereas making a TreeCollision object for every piece of terrain would require a LOT of memory. however if you want to make a TreeCollision, I would suggest only using the highest LOD level, because most active objects will probably be near the camera, and thus should react to the terrain realistically...
on a side thought, using the Heightmap collision system, you could probably get Newton working with the Paging Landscape scene manager as well!
I've personally not yet attempted to get this to work with Ogre, but I'm certain it's possible, assuming you can access the heightmap data.
p.s. my vehicle demo is coming along nicely, I finally got texture shadows working yesterday
on a side thought, using the Heightmap collision system, you could probably get Newton working with the Paging Landscape scene manager as well!
I've personally not yet attempted to get this to work with Ogre, but I'm certain it's possible, assuming you can access the heightmap data.
p.s. my vehicle demo is coming along nicely, I finally got texture shadows working yesterday
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
OgreNewt Vehicle demo
this is a WIP demo of my OgreNewt vehicle... using Newton for the vehicle dynamics. there is still a LOT to be adjusted, but I think it runs alright!
DOWNLOAD LINK
CONTROLS:
W S A D - acceleration / steering
Q Z shift up/down
SPACE BAR parking break
this is a WIP demo of my OgreNewt vehicle... using Newton for the vehicle dynamics. there is still a LOT to be adjusted, but I think it runs alright!
DOWNLOAD LINK
CONTROLS:
W S A D - acceleration / steering
Q Z shift up/down
SPACE BAR parking break
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
- Sputnick
- Greenskin
- Posts: 110
- Joined: Wed Sep 08, 2004 11:49 pm
- Location: Lausanne, Switzerland
Very nice.
There some parts I don't understand:
1) When you try to climb the slope, you are often blocked at 1000 RPM. This correspond to 200 engine torque and 345 wheel torque, independently in which gear you're in. I would expect to get lot more torque at wheels in 1st gear than in 6th, in fact 5.7 time more as it is the reduction ratio from 6 to 1. Same thing for rear gear where you should get even more wheel torque.
2) It is probably coming from the engine toque curve, but in 1st gear, if you stop in the slope, you don't have enough power to climb again and you stay stucked at 1000 RPM. On the other hand, with a little speed, the engine gets to high RPM very fast. 200 seems to low at 1000 RPM.
3) The car seems to so light when it rolls and bounces and so heavy when it tries to climb the slope.
All these might come from my configuration as I just tried it on my laptop at work.
A few more question, is it front, rear or 4x4 wheel drive ?
How often is runing the Newton loop compared to the rendering one ?
- Sput
There some parts I don't understand:
1) When you try to climb the slope, you are often blocked at 1000 RPM. This correspond to 200 engine torque and 345 wheel torque, independently in which gear you're in. I would expect to get lot more torque at wheels in 1st gear than in 6th, in fact 5.7 time more as it is the reduction ratio from 6 to 1. Same thing for rear gear where you should get even more wheel torque.
2) It is probably coming from the engine toque curve, but in 1st gear, if you stop in the slope, you don't have enough power to climb again and you stay stucked at 1000 RPM. On the other hand, with a little speed, the engine gets to high RPM very fast. 200 seems to low at 1000 RPM.
3) The car seems to so light when it rolls and bounces and so heavy when it tries to climb the slope.
All these might come from my configuration as I just tried it on my laptop at work.
A few more question, is it front, rear or 4x4 wheel drive ?
How often is runing the Newton loop compared to the rendering one ?
- Sput
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
the car is rear-wheel-drive.
Newton is being called once per loop.
all of those are issues with adjusting the vehicle settings... I'm glad there weren't any other big issues
right now, the RPM is set to never go lower than 1000rpm... which needs some adjusting! I think the way I'm limiting that is causing the problem. if you get it moving just a little, you can see that the gears produce very different torque... I'll continue working on the settings.
p.s. by editing the "smart.vehicle" file, you can change nearly all of the various settings for the vehicle, including the size/mass/suspenstion settings position of the tires, the engine power curve, etc. you can even make the car 4WD, or have 4-wheel-steering, etc.
Newton is being called once per loop.
all of those are issues with adjusting the vehicle settings... I'm glad there weren't any other big issues
right now, the RPM is set to never go lower than 1000rpm... which needs some adjusting! I think the way I'm limiting that is causing the problem. if you get it moving just a little, you can see that the gears produce very different torque... I'll continue working on the settings.
p.s. by editing the "smart.vehicle" file, you can change nearly all of the various settings for the vehicle, including the size/mass/suspenstion settings position of the tires, the engine power curve, etc. you can even make the car 4WD, or have 4-wheel-steering, etc.
-
- Goblin
- Posts: 217
- Joined: Thu Oct 24, 2002 4:12 am
- x 1
- Contact:
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
- sinbad
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
- Contact:
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
thanks for the replies!
I definately need to do some more tweaking on the suspension settings... as for the 7000rpm thing, that's just an issue of adjusting the power curve of the car. right now I have it hard-coded that all cars have a power curve defined between 1000-7000 rpm, and the engine uses linear-interpolation to get the engine torque each loop. by making the peak at a lowe rpm, I can make the engine "max out" at say 5000rpm or so. also the transmission is probably a bit unrealistic for such a tiny car as well.
I'm now modelling some other cars, working on a Ford Mustang right now...
SCREENSHOT HERE
p.s. the environment map was really easy using Gile[s] (and the exporter I'm working on)
I definately need to do some more tweaking on the suspension settings... as for the 7000rpm thing, that's just an issue of adjusting the power curve of the car. right now I have it hard-coded that all cars have a power curve defined between 1000-7000 rpm, and the engine uses linear-interpolation to get the engine torque each loop. by making the peak at a lowe rpm, I can make the engine "max out" at say 5000rpm or so. also the transmission is probably a bit unrealistic for such a tiny car as well.
I'm now modelling some other cars, working on a Ford Mustang right now...
SCREENSHOT HERE
p.s. the environment map was really easy using Gile[s] (and the exporter I'm working on)
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
- monster
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
- Contact:
Your wish is my command;
Nice demo by the way walaber! If you find any of my code useful then feel free to make use of it.
Oh, and thanks again to Sascha Willems for permission to use the 'ramps' mesh.
As the instructions and the News item says, it's unlikely that I'll be developing this wrapper further. Hopefully I'll be able to get an ODF wrapper working for Ogre and then create an OpenPhysics interface for Newton.monster wrote:COMMENTS DELETED
How so? Small engines tend to rev much higher than big engines. The 3 cylinder turbo-charged engine in this thing (it's like a little Smart car, isn't it?) would easily pull 7000rpm, the red-line would probably be more like 8500-9000, motorbikes rev to like 15,000 whilst big 'ol V8s wouldn't want to go much above maybe 5000. Or are you saying that 7000 isn't high enough?stodge wrote:It seems odd that such a tiny car can rev to 7000RPM though.
Nice demo by the way walaber! If you find any of my code useful then feel free to make use of it.
Oh, and thanks again to Sascha Willems for permission to use the 'ramps' mesh.
Last edited by monster on Sat Jan 08, 2005 2:09 pm, edited 1 time in total.
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
Monster - thanks for the comments, yes the car is a "Smart". I'm glad you recognized it! I'll continue to update the car settings, and eventually release a mini-game based on it.
very cool to see your source, unfortunately I'm leaving for a new years trip today, so I won't have a chance to look at it for a while.
my code is probably much simpler, but I'm happy with it so far...
once I release my mini-game, I'll release it's source as well.... with perhaps a simple tutorial explaining how to get Ogre and Newton to be friends
I already have lots of ideas for other physics-based games... just no time to implement them
take it easy and Happy New Year everyone!
very cool to see your source, unfortunately I'm leaving for a new years trip today, so I won't have a chance to look at it for a while.
my code is probably much simpler, but I'm happy with it so far...
once I release my mini-game, I'll release it's source as well.... with perhaps a simple tutorial explaining how to get Ogre and Newton to be friends
I already have lots of ideas for other physics-based games... just no time to implement them
take it easy and Happy New Year everyone!
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
Well, monster, i downloaded Ogrewton, but its a little complex for my own tastes, so i'm trying my hand at my own uber simple wrapper
Anyway, i'm having trouble with box stacking:
As you can see, the boxes don't seem to want to have the right bounds.
Any ideas?
The Pertinant Code:
That creates the box primative
that code is what i use to initialize the body on my entity
As you can see, it collides with the floor right (although every now and then one falls through, still need to get to that.
Any ideas on what i could fix to get this workign? Or more info if needed.
Thx, Robo
[EDIT]
Thanks to monster for the floor texture and various bits and bobs of code i mercilessly stole from him
Anyway, i'm having trouble with box stacking:
As you can see, the boxes don't seem to want to have the right bounds.
Any ideas?
The Pertinant Code:
Code: Select all
m_Collision = NewtonCreateBox(m_NewtonWorld, dimensions.x, dimensions.y, dimensions.z, NULL);
Code: Select all
Ogre::Vector3 aabb = *(m_Entity->getBoundingBox().getAllCorners());
m_Body = new NewtOgre::Body(m_Node, aabb, 5.0f);
As you can see, it collides with the floor right (although every now and then one falls through, still need to get to that.
Any ideas on what i could fix to get this workign? Or more info if needed.
Thx, Robo
[EDIT]
Thanks to monster for the floor texture and various bits and bobs of code i mercilessly stole from him
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
- monster
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
- Contact:
Yeah, the code behind it's reasonably "interesting" but the interface is almost exactly equivalent to the standard Newton one.Well, monster, i downloaded Ogrewton, but its a little complex for my own tastes
Any ideas?
Nope, none!
You realise that you're displaying the AABB, rather than the actual oriented bounds of the boxes, yes? (Ogrewton will display the 'true' collision geometries for you, if you like)
Also, are your box meshes centered about the origin, 'cos that's where the collision proxy will be (by default).
Apart from that, trace through your code to make sure the NewtonCreateBox call is being given the correct dimensions.
I've never seen any objects fall through any other objects in Newton, are you using a big box for your floor or a tree collision? I've heard it said that the optimisation of the tree collision mesh can 'lose' triangles, but I've never seen that myself.
[edit]D'oh, you fixed it before I could post![/edit]
- Robomaniac
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
NewtOgre is coming together nicely, in a small lite package, that imho is very easy to use
2 main classes so far (with the Debug_Lines class ripped straight from Ogrewton (i give u credit in the source monster)).
I still need to figure out a better way to see if i can autogenerate the bodies from the bounding boxes, as right now on certain meshes (including crate.mesh), i'm getting a "buffer" of a few units on the outside of the crate (can this be changed in the mesh, or is it autogened by the entity?)
Expect some more updates soon
[edit]
Newton is very stable for box stacking:
http://centaurforce.sourceforge.net/100boxes.jpg
100 boxes stacked on each other
2 main classes so far (with the Debug_Lines class ripped straight from Ogrewton (i give u credit in the source monster)).
I still need to figure out a better way to see if i can autogenerate the bodies from the bounding boxes, as right now on certain meshes (including crate.mesh), i'm getting a "buffer" of a few units on the outside of the crate (can this be changed in the mesh, or is it autogened by the entity?)
Expect some more updates soon
[edit]
Newton is very stable for box stacking:
http://centaurforce.sourceforge.net/100boxes.jpg
100 boxes stacked on each other
Last edited by Robomaniac on Thu Dec 30, 2004 8:55 am, edited 1 time in total.
- monster
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
- Contact:
It's baked into the Mesh when the creator set the bounds with _setBounds(const AxisAlignedBox &bounds, bool pad=true)....i'm getting a "buffer" of a few units on the outside of the crate (can this be changed in the mesh, or is it autogened by the entity?)
But you can't tell from the mesh whether or not the bounds were padded when set, or not. It's your exporter that sets the bounds on your exported meshes, so only that will know whether or not the bounds were padded. The Ac3d exporter, for example, doesn't pad the bounding box so it should fit snugly.
The only reliable way to get the bounds is to calculate them yourself from the vertex buffer, like OgreOde does.
- Xypher
- Gremlin
- Posts: 180
- Joined: Tue Jun 29, 2004 1:35 am
- Location: Richmond, IN; USA
- Contact:
- walaber
- OGRE Expert User
- Posts: 829
- Joined: Sat Oct 02, 2004 2:20 pm
- Location: California, USA
- Contact:
well.. there's nothing really to "release".. but with my mini-game, I'll include the source, maybe some people will find it useful...
I have to do a bit of modelling now before I can go much farther though...
robomaniac- looking great!! I'd be interested to see if you get ragdolls working, I'm not yet familiar enough with Ogre to try!
I have to do a bit of modelling now before I can go much farther though...
robomaniac- looking great!! I'd be interested to see if you get ragdolls working, I'm not yet familiar enough with Ogre to try!