The OgreOde Thread
-
- Gnoblar
- Posts: 7
- Joined: Tue Nov 16, 2004 11:41 am
hi monster! I would like to say that your OgreOde is fantastic !! I've had trouble using vanilla ODE and it is a sight for sore eye! can I send you a thank you card for that ?
I have a problem though, How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis and not the world's Z axis. I tried _getDerivedOrientaton but it didn't work
I have a problem though, How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis and not the world's Z axis. I tried _getDerivedOrientaton but it didn't work
-
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
They're not both trimesh objects. The Terrain demo uses the special terrain collision primitive, which can handle much larger terrains, much more efficiently than using a Trimesh. It does mean that you have to modify ODE though to add that collision primitive. The trimesh demo isn't a terrain, it's just a mesh that looks like a little chunk of terrain.It just seemed strange that if they are both trimesh objects that the jeep is fine but the boxstack with terrain isn't.
You shouldn't need to edit/pick any versions of config.h, as I understand it that's what the configurator.exe (built with "make configure") component of ODE does for you, based on your user settings.There is a config.h file that works and a few that don't for vc7. I had picked/edited the wrong one(s). The correct one(s) are in C:\Program Files\ODE\contrib\msvc7\ode_default or tricollider.
Take a look at the code for MeshInformer::createStaticTriangleMesh, which looks something like this;How do you use the ODE trimesh class. What ODE functions do you need to call and what do you need to pass into them.
Also, how do you count vertices from a mesh?
Code: Select all
TriangleMeshGeometry* MeshInformer::createStaticTriangleMesh(SceneNode* node,Space* space)
{
MeshInformer mi;
TriangleMeshGeometry* geom = 0;
mi.addAllMeshes(node,node->getPosition(),node->getOrientation(),node->getScale());
if(mi.getVertexCount() && mi.getIndexCount())
{
geom = new TriangleMeshGeometry(mi.getVertices(),mi.getVertexCount(),mi.getIndices(),mi.getIndexCount(),space);
}
return geom;
}
Use Body::addRelativeTorque. See the ODE docs for more details.How can I use the addTorque(const Vector3& torque) method to apply torque only to the vehicle's Z axis
Not now, apparently, no.You're not going to die on us are you?
-
- Kobold
- Posts: 28
- Joined: Sat Jan 17, 2004 7:45 pm
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
Hi, I am trying to come up with a movement system for my fps OgreODE game. Right now I have an ODE sphere and I am floating a camera above it. I am setting the sphere's orientation to be the same as the player's orientation every frame, and this seemed to work pretty well for controlling movement with addRelativeTorque.
The problem I ran into was I couldn't set a ceiling for the movement speed. getTorque() seemed to not work, it always returned the same value for every axis(-1.0737418e+008). The function seems broken.. I thought maybe manually setting orientation was screwing it up, but I discovered it behaved the same even when I didn't mess with it's orientation.
So I thought it might be better to set the sphere's linear velocity directly, but the issue I am having with that is that there is no way to do it relatively... Or is there? I imagine there is some way to use the data of the sphere's orientation Quaternion to make a Vector3 that will 'point' the velocity in the right direciton.. But I just don't know the math behind it
Any suggestions?
The problem I ran into was I couldn't set a ceiling for the movement speed. getTorque() seemed to not work, it always returned the same value for every axis(-1.0737418e+008). The function seems broken.. I thought maybe manually setting orientation was screwing it up, but I discovered it behaved the same even when I didn't mess with it's orientation.
So I thought it might be better to set the sphere's linear velocity directly, but the issue I am having with that is that there is no way to do it relatively... Or is there? I imagine there is some way to use the data of the sphere's orientation Quaternion to make a Vector3 that will 'point' the velocity in the right direciton.. But I just don't know the math behind it
Any suggestions?
I <3 the OGRE Wiki, and SO SHOULD YOU!
-
- OGRE Retired Moderator
- Posts: 2060
- Joined: Thu Feb 26, 2004 12:11 am
- Location: Toronto, Canada
- x 3
All the code you need for setting linear velocity directly can be found here:
http://www.larabie.net/ogre/LOTGameInterface.cpp
and
http://www.larabie.net/ogre/LOTGameInterface.h
Those files are temporary and posted just for you!
Note that much of this code was inspired by code from here:
http://www.vrac.iastate.edu/~streeter/m ... round.html
Clay
http://www.larabie.net/ogre/LOTGameInterface.cpp
and
http://www.larabie.net/ogre/LOTGameInterface.h
Those files are temporary and posted just for you!
Note that much of this code was inspired by code from here:
http://www.vrac.iastate.edu/~streeter/m ... round.html
Clay
-
- Halfling
- Posts: 50
- Joined: Wed Dec 24, 2003 6:18 pm
- Location: lexington, KY USA
-
- Gremlin
- Posts: 160
- Joined: Tue May 25, 2004 2:18 pm
- Location: Ukraine/Ternopil
Hi !
Question 1:
how I can detect ONLY COLLISION (without jumping away objects)
Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.
I just try to correctly detect an entity (with Body) in a center of screen.
at first i was tried to use RayQuery of Ogre, but it detect only bounding box, and I need to detect it more correctly.
Thank you.
Question 1:
how I can detect ONLY COLLISION (without jumping away objects)
Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.
I just try to correctly detect an entity (with Body) in a center of screen.
at first i was tried to use RayQuery of Ogre, but it detect only bounding box, and I need to detect it more correctly.
Thank you.
-
- Halfling
- Posts: 50
- Joined: Wed Dec 24, 2003 6:18 pm
- Location: lexington, KY USA
Well i started to make linux makefiles for OgreOde. I don't know how to make it work in the scripts directory, so the top (where configure.in)is ogrenew/OgreOde. Anyway OgreOde compiles, haven't tested install, but I'm having trouble with the demo SimpleScenes. When it compiles i get a bunch of errors about "undefined reference to `OgreOde::..." not sure why.
If anyone wants to take a look get the files here http://www.ceejs.com/eric/ogreode.makefiles.tgz
Heres a snip of the errors... it goes on for about 200 lines.
If anyone wants to take a look get the files here http://www.ceejs.com/eric/ogreode.makefiles.tgz
Heres a snip of the errors... it goes on for about 200 lines.
Code: Select all
g++ -g -O2 -o .libs/SimpleScenes ./SimpleScenes.o ./SimpleScenesApplication.o -L/home/rastaman/src/ogre/ogrenew/OgreOde/src -L/home/rastaman/src/ogre/ogrenew/OgreOde/ode-0.5/lib /home/rastaman/src/ogre/ogrenew/OgreOde/src/.libs/libOgreOde -lOgreMain -lz -lm -lode
./SimpleScenes.o(.text+0x81): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
./SimpleScenes.o(.text+0x25e): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/usr/include/g++/i586-suse-linux/bits/gthr-default.h:512: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0x384): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `OgreOde::Body::MovableType'
./SimpleScenes.o(.text+0x553): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
../../../include/OgreOdeStepper.h:12: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0x59c): In function `SimpleScenes::~SimpleScenes [in-charge deleting]()':
../../../../OgreMain/include/OgreMemoryManager.h:420: undefined reference to `OgreOde::World::setCollisionListener(OgreOde::CollisionListener*)'
./SimpleScenes.o(.text+0x901): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
./SimpleScenes.o(.text+0xade): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/usr/include/g++/i586-suse-linux/bits/gthr-default.h:512: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0xbea): In function `SimpleScenes::~SimpleScenes [in-charge]()':
/usr/include/g++/bits/basic_string.h:249: undefined reference to `OgreOde::Body::MovableType'
./SimpleScenes.o(.text+0xdb5): In function `SimpleScenes::~SimpleScenes [in-charge]()':
../../../include/OgreOdeStepper.h:12: undefined reference to `OgreOde::CollisionListener::~CollisionListener [not-in-charge]()'
./SimpleScenes.o(.text+0xdfe): In function `SimpleScenes::~SimpleScenes [in-charge]()':
../../../../OgreMain/include/OgreMemoryManager.h:420: undefined reference to `OgreOde::World::setCollisionListener(OgreOde::CollisionListener*)'
./SimpleScenes.o(.text+0x1161): In function `SimpleScenes::~SimpleScenes [not-in-charge]()':
/home/rastaman/src/ogre/ogrenew/OgreOde/demos/SimpleScenes/src/SimpleScenes.cpp:162: undefined reference to `OgreOde::World::getCollisionListener()'
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
@Falagard: Thanks a ton! I'll check these out tonight.
EDIT: Tried it out and it works great. Nice job!
@Troglodit:
EDIT: Tried it out and it works great. Nice job!
@Troglodit:
I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener.. Just check which objects are involved in the collision and return false if you don't want them to 'hit'? I havn't done this, but it sounds like it should workTroglodit wrote:Question 1:
how I can detect ONLY COLLISION (without jumping away objects)
I <3 the OGRE Wiki, and SO SHOULD YOU!
-
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
Bingo. In fact Falagard's code does exactly this by setting (and checking) the collision bitfield. You could also use the category bitfield, or even the user data value to decide whether or not your collision should be ignored.I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener. Just check which objects are involved in the collision and return false if you don't want them to 'hit'?
Don't. If you're needing to manually set positions and orientations (apart from during the set up of your scene) then you're breaking the laws of physics that ODE is designed to preserve. If your body isn't in the right position then you should apply a force to move it towards the position it should be in. If it's not oriented correctly then you should apply a torque until it is.Question 2:
how correctly do setPosition()/setOrientation() to Entyties with Bodyes without forces.
-
- Gremlin
- Posts: 160
- Joined: Tue May 25, 2004 2:18 pm
- Location: Ukraine/Ternopil
Bingo. In fact Falagard's code does exactly this by setting (and checking) the collision bitfield. You could also use the category bitfield, or even the user data value to decide whether or not your collision should be ignored.
Thanks. I will try.I think you could do this by altering the collision(OgreOde::Contact* contact) function of your class inheriting from OgreOde::CollisionListener.. Just check which objects are involved in the collision and return false if you don't want them to 'hit'? I havn't done this, but it sounds like it should work
I was afraid of it . This SetPosition/SetOrientation I must apply to CAMERA+ray. I think it is simpler to shoot oneself than correctly calculate the forces to move/rotate/stop the camera. May be anyone has a sample ?Don't. If you're needing to manually set positions and orientations (apart from during the set up of your scene) then you're breaking the laws of physics that ODE is designed to preserve. If your body isn't in the right position then you should apply a force to move it towards the position it should be in. If it's not oriented correctly then you should apply a torque until it is.
May be I can dinamically create thar ray every frame, detect collision (if it present) and remove it ?
-
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
I must apply to CAMERA+ray... May be anyone has a sample ?
Isn't that what Falagard's code does?
Meanwhile, here's a in-development shot of the Ragdoll "Prefab" (as I'm now calling them) - The geometries and joints are set up automatically (although you can configure them to a certain extent) based on the current state of the animation of the skeleton. So when you shoot something that's walking the ragdoll will take over from wherever they currently are in the "walk" animation.
Kill the zombie!
-
- OGRE Retired Team Member
- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 66
-
- OGRE Retired Moderator
- Posts: 2060
- Joined: Thu Feb 26, 2004 12:11 am
- Location: Toronto, Canada
- x 3
Oohh.. sweet!
How are you doing it, Monster? Ragdoll usually requires some sort of joint set up with constraints doesn't it?
Are you just using (ball?) joints at each bone location instead, and not worrying about constraints?
When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation, or just turning off the animation and allowing the physics to take over as if the character weren't moving?
Just curious - either way this is cool, and great work
Clay
How are you doing it, Monster? Ragdoll usually requires some sort of joint set up with constraints doesn't it?
Are you just using (ball?) joints at each bone location instead, and not worrying about constraints?
When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation, or just turning off the animation and allowing the physics to take over as if the character weren't moving?
Just curious - either way this is cool, and great work
Clay
-
- Hobgoblin
- Posts: 508
- Joined: Tue Feb 03, 2004 6:39 am
-
- Gnome
- Posts: 302
- Joined: Fri Feb 20, 2004 8:52 pm
- Location: Lahore, Pakistan
-
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
Capsules work fine, why wouldn't they?
You can set the joint limits (and types of joint used, and types of geometry used) programatically.
There isn't a front-end, the idea is that it's as automatic as possible.
You can set the joint limits (and types of joint used, and types of geometry used) programatically.
There isn't a front-end, the idea is that it's as automatic as possible.
That's a cool idea. But there are plenty of other things to worry about first!When ragdoll kicks in, are you actually taking into account the linear/angular velocity of the bones in the animation...
-
- Gremlin
- Posts: 150
- Joined: Wed Oct 20, 2004 2:35 pm
- Location: Paris, France
-
- Gnoblar
- Posts: 6
- Joined: Sun Nov 14, 2004 11:05 am
-
- OGRE Community Helper
- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
-
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
-
- Gnoblar
- Posts: 19
- Joined: Mon Aug 16, 2004 1:48 am
- Location: East Sussex, England
Hi Monster,
thanks for the awesome update to OgreODE... the landscape project looks like it should be a great starting point for almost any vehicle based game!
I've been playing around with it a bit and as I didn't like the extreme bouncy feel of the vehicle I was mucking around with the suspension damping factors and not getting the results I wanted... I'm not sure if this is a bug or just a different way of doing things but it seems to me like the damping factor should be range 0.0 -> 1.0 (you have it set at 0.9 currently) should the lines in Vehicle::Wheel::setSuspension that set ERP and CFM use a value of:
_step * _spring / (_step * _spring / _damping)
rather than
_step * _spring / (_step * _spring + _damping)
?
Using a damping value of 0.1 now produces extreme damping, and obviously 0.9 produces almost no damping at all, so maybe (1.0 - _damping) would be better. Of course it should trap the divide by zero elegantly. The jeep feels really solid with this damping set to 0.25.
Oh, while I was at it I set _spring to 100 (rather than 50) in landscape.cpp, and increase the vehicle speed by using a revlimit of 50, and a max torque of 20... this lets the jeep fly across the terrain fast enough to jump over most humps Moving the camera back to a follow distance of 18.0 helps reduce travel sickness too!
Quick question... is it possible to deform this landscape type on-the-fly?
thanks for the awesome update to OgreODE... the landscape project looks like it should be a great starting point for almost any vehicle based game!
I've been playing around with it a bit and as I didn't like the extreme bouncy feel of the vehicle I was mucking around with the suspension damping factors and not getting the results I wanted... I'm not sure if this is a bug or just a different way of doing things but it seems to me like the damping factor should be range 0.0 -> 1.0 (you have it set at 0.9 currently) should the lines in Vehicle::Wheel::setSuspension that set ERP and CFM use a value of:
_step * _spring / (_step * _spring / _damping)
rather than
_step * _spring / (_step * _spring + _damping)
?
Using a damping value of 0.1 now produces extreme damping, and obviously 0.9 produces almost no damping at all, so maybe (1.0 - _damping) would be better. Of course it should trap the divide by zero elegantly. The jeep feels really solid with this damping set to 0.25.
Oh, while I was at it I set _spring to 100 (rather than 50) in landscape.cpp, and increase the vehicle speed by using a revlimit of 50, and a max torque of 20... this lets the jeep fly across the terrain fast enough to jump over most humps Moving the camera back to a follow distance of 18.0 helps reduce travel sickness too!
Quick question... is it possible to deform this landscape type on-the-fly?
Pete Baron
antispam_sibaroni@hotmail.com (remove 'antispam_' to mail me)
http://home.btconnect.com/pete/homepage.html
antispam_sibaroni@hotmail.com (remove 'antispam_' to mail me)
http://home.btconnect.com/pete/homepage.html
-
- Halfling
- Posts: 96
- Joined: Thu Oct 07, 2004 7:18 pm
- Location: Veracruz, Mexico
Hi monster!
i just compile your OgreOde with mingw and the agency version of ogre.
I only want to say that if someone has interest in compiling ogreode with mingw, you have to do the following modification to the OgreOdePreReqs.h file
it would be great if this patch is included in the next version of OgreOde
i just compile your OgreOde with mingw and the agency version of ogre.
I only want to say that if someone has interest in compiling ogreode with mingw, you have to do the following modification to the OgreOdePreReqs.h file
Code: Select all
#ifndef _OGREODEPREREQS_H_
#define _OGREODEPREREQS_H_
#include "Ogre.h"
#include "OgreNoMemoryMacros.h"
#include "ode/ode.h"
#include "OgreMemoryMacros.h"
using namespace Ogre;
// #define OGREODE_TERRAINGEOMETRY
// #define OGREODE_PLANARJOINT
namespace OgreOde
{
#if OGRE_PLATFORM == PLATFORM_WIN32
// Begin Modification
#ifdef __MINGW32__
#define _OgreOdeExport
#else
# if defined( OGREODE_EXPORTS )
# define _OgreOdeExport __declspec( dllexport )
# else
# define _OgreOdeExport __declspec( dllimport )
# endif
#endif
// End Modification
#else
# define _OgreOdeExport
#endif
class World;
class Body;
class Mass;
class JointGroup;
class Joint;
class Space;
class Geometry;
class TriangleMeshGeometry;
class BoxGeometry;
class CollisionListener;
class Contact;
class DebugObject;
class Stepper;
class MaintainedItem;
}
#endif
-
- Halfling
- Posts: 88
- Joined: Wed Sep 29, 2004 3:33 am
- Location: Ohio, USA
Well I just got the 'final' version of the scene/meshes for our level. It is about a 55k poly city (most textures not on it yet).
I loaded it up (using some additions to the sceneloader to have it create an ODE trimesh) and was a little upset to see i was getting about 20-30fps on my comp. With no textures, and taking into account my comp is much beefier then the comps at school.. I am a bit worried about it running playably there.
To see how much effect ODE was having on performance I disabled the trimesh loading.. About 100fps. Not bad, so it is ODE that is causing the hit. Well I knew trimeshes are expensive, so I can only blame myself.
The thing that is really confusing me though is this: With ODE on when I move out from the city (so that the whole thing is in view) the tricount is about 110k. With ODE off when I move out it is 55k (which my artist claims it should be at). So.. Can anyone explain to me where that extra 55k is coming from?
I thought about the possibility of it generated from the debug info, but it is still 110k when debug info is off.. I realize it could still be maintaining the debug info invisibly. If this is the case, then is there a way I can totally disable the debug info? I am guessing that cutting those extra 55k polys mgiht help my performance a bit.
Thanks.. And Monster that ragdoll pic looks absolutely sweet. I can't wait to see it in motion!
I loaded it up (using some additions to the sceneloader to have it create an ODE trimesh) and was a little upset to see i was getting about 20-30fps on my comp. With no textures, and taking into account my comp is much beefier then the comps at school.. I am a bit worried about it running playably there.
To see how much effect ODE was having on performance I disabled the trimesh loading.. About 100fps. Not bad, so it is ODE that is causing the hit. Well I knew trimeshes are expensive, so I can only blame myself.
The thing that is really confusing me though is this: With ODE on when I move out from the city (so that the whole thing is in view) the tricount is about 110k. With ODE off when I move out it is 55k (which my artist claims it should be at). So.. Can anyone explain to me where that extra 55k is coming from?
I thought about the possibility of it generated from the debug info, but it is still 110k when debug info is off.. I realize it could still be maintaining the debug info invisibly. If this is the case, then is there a way I can totally disable the debug info? I am guessing that cutting those extra 55k polys mgiht help my performance a bit.
Thanks.. And Monster that ragdoll pic looks absolutely sweet. I can't wait to see it in motion!
I <3 the OGRE Wiki, and SO SHOULD YOU!