The OgreOde Thread

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Locked
Brutha
Gnoblar
Posts: 18
Joined: Wed Oct 13, 2004 12:40 pm

Post by Brutha »

Hm as there is no Ode Forum I'll just ask here.. did anyone use a Amotor (AngularMotorJoint) yet ?

And if yes, could you show me some example source ? :)
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 »

@ thegame
How much has changed in this version of OgreOde ?

Not a lot, it's mostly just incorporating the changes people have suggested to make the code better and more portable. What's new;
  • The Vehicle stuff - but still needs a lot of work!
    Utility functions (the MeshInformer) - makes it easier to build Trimeshes, bounding spheres and bounding boxes from Ogre nodes without having to manually read the vertex/index data. See how much the Trimesh sample has been simplified.
    The terrain collision primitive and...
    The planar (2.5D) joint - but you'll have to modify ODE itself (instructions included) to support these two
    An automatic "combination of materials" collision listener - that I haven't actually tested yet!
    Changes to the auto disable stuff - it's now sleep/wake rather than disable/enable
    A few changes to make it work with the latest versions of ODE and Ogre.
my bandwith sucks and 2 mb for me is like 200 !!
Seriously? That does suck. Last month I managed to download nearly 6Gb so 2Mb is a drop in the ocean!
:(

@ Brutha
...as there is no Ode Forum I'll just ask here.
Actually there is an ODE forum, it's here;
http://ode.petrucci.ch/

Or there's always the ODE mailing list;
http://q12.org/mailman/listinfo/ode

Just don't mention that you're using some dodgy wrapper, pretend you're using the actual ODE functions! As I've said before, the function calls should be pretty much exact equivalents of the raw ODE stuff, so the ODE docs and any pure ODE example code should be easy enough to translate.

Part of the documentation that I need to do will be letting people know the equivalent ODE functions (and enums, etc) for the OgreOde stuff. Most of it's obvious, but in some cases I've attempted to make the names a bit more meaningful, and probably just made them more confusing!

But, no, I've never used AMotors myself.
Brutha
Gnoblar
Posts: 18
Joined: Wed Oct 13, 2004 12:40 pm

Post by Brutha »

Thanks. I'm using the mailing list now but I like forums because of the search button *g* The unofficial ode forum is quite empty,
User avatar
Troglodit
Gremlin
Posts: 160
Joined: Tue May 25, 2004 2:18 pm
Location: Ukraine/Ternopil
Contact:

Post by Troglodit »

Hi !
How I can create cilynder with ogreode ?
Or I can create olny box,capsule and ball ?
User avatar
Troglodit
Gremlin
Posts: 160
Joined: Tue May 25, 2004 2:18 pm
Location: Ukraine/Ternopil
Contact:

Post by Troglodit »

An another one question.

In helicopter demo i try to create one more compound object.
New object collid with boxes but do not collid with helicopter and rockets :shock: .
Strange...

i include then code in constructor

Code: Select all

//*************************************************************************
		Entity* shashka_entity;
		shashka_entity=_mgr->createEntity("Shashka", "Cylinder04.mesh");
		shashka_entity->setCastShadows(true);
		
		SceneNode* shashka_node=_mgr->getRootSceneNode()->createChildSceneNode("Shashka");
		shashka_node->attachObject(shashka_entity);
		shashka_node->setPosition(0,4,0);
		shashka_node->setScale(0.1,0.1,0.1);


		OgreOde::SimpleSpace* shashka_space= new OgreOde::SimpleSpace(_space);
		shashka_space->setInternalCollisions(false);
		OgreOde::BoxMass shashka_mass(1.5,Vector3(1,1,1));

		OgreOde::Body* shashka_body = new OgreOde::Body();
		shashka_node->attachObject(shashka_body);
		shashka_body->setMass(shashka_mass);
		_bodies.push_back(shashka_body);
		_last_node=shashka_node;


		OgreOde::TransformGeometry* transformGeometry = new OgreOde::TransformGeometry(shashka_space);
		OgreOde::BoxGeometry* shashka_geometry = new OgreOde::BoxGeometry(Vector3(1.0,1.0,1.0));
		transformGeometry->setBody(shashka_body);
		transformGeometry->setEncapsulatedGeometry(shashka_geometry);
		shashka_geometry->setPosition(Vector3( 0,0,0));
		_geoms.push_back(shashka_geometry);
		_geoms.push_back(transformGeometry);
		//**************************************************************************
Do Ogreode support collision between two compound objects like helicopter ?

Thanks.
Brutha
Gnoblar
Posts: 18
Joined: Wed Oct 13, 2004 12:40 pm

Post by Brutha »

I played a bit with angular motors and I think there is a function missing in OgreOde.

In Ode Manual it says:

7.5.1. Parameter Functions (setParameter)
These parameter names can be optionally followed by a digit (2 or 3) to indicate the second or third set of parameters, e.g. for the second axis in a hinge-2 joint, or the third axis in an AMotor joint. A constant dParamGroup is also defined such that: dParamXi = dParamX + dParamGroup * (i-1).

There should either be a public ParamGroup in the Joint Class or just in enum Parameter
LowStop2 = dParamLoStop2,
and so on :roll:

If there is already a way to do this I apologize :)
User avatar
Peggus
Gnoblar
Posts: 11
Joined: Tue Aug 10, 2004 9:08 pm
Location: Pasadena, CA
Contact:

Post by Peggus »

If I remember correctly I had to add some ENUMs to ogreode as well, I think it had something to do with AMotors. It is a rather trivial change.
Brutha
Gnoblar
Posts: 18
Joined: Wed Oct 13, 2004 12:40 pm

Post by Brutha »

I just added:

MotorVelocity2 = dParamVel2,
MotorVelocity3 = dParamVel3,

to "enum Parameter" in OgreOdeJoint.h . That worked for me since I didn't need anything else, but I think there are certain conditions where you need more input for the other parameters. Just wanted to report it :) :roll:

BTW I love OgreOde thanks Monster :)
User avatar
thegame
Gnoblar
Posts: 23
Joined: Tue Aug 31, 2004 7:50 am

Post by thegame »

Downloaded the preview version of OgreOde...

StringUtil::BLANK undeclared identifier - I figured this out myself, using Ogre 0.14 and with the latest Ogre its moved from String to StringUtil.

Compiling Demo_SimpleScreens

Code: Select all

 SimpleScenesApplication.cpp
..\..\include\SimpleScenes_Buggy.h(63) : error C3861: 'Radian': identifier not found, even with argument-dependent lookup
SimpleScenes.cpp 
I guess this has also got to do with the new Ogre - or is it something else ??
Linux Rocks!!!
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 »

StringUtil::BLANK undeclared identifier - I figured this out myself, using Ogre 0.14
From the original post announcing this version;
You should extract the Zip to your ogrenew (or whatever you've renamed it to) directory, remembering to preserve the directory structure. And that ogrenew directory should contain a reasonably recent CVS snapshot of Ogre, mine's from a couple of days ago.
And from the post mentioning some of the changes;
A few changes to make it work with the latest versions of ODE and Ogre.
So yes, the implication is that it will only work with a resaonably recent version of Ogre. It's targetted at the 0.15 release. Sorry, that should probably be in the readme.
How I can create cilynder with ogreode
You can't. Because ODE can't. There are some cylinder contributions available for ODE but at the moment the concensus seems to be that they're not really ready for prime time. Especially when colliding with trimeshes. If this changes, or if anyone would like to point out that it has changed already, then I'll be happy to incorporate a cylinder primitive into OgreOde.
Do Ogreode support collision between two compound objects like helicopter
Yep, it should, if ODE does. Which it does. You have to make sure your geometries are in different spaces, or if they're in the same space, that you've got "internal collisions" switched on for that space.
7.5.1. Parameter Functions (setParameter)
These parameter names can be optionally followed by a digit (2 or 3)
That looks like something I've missed out. Sorry about that. I'll look into it and add the missing bits as appropriate.

Thanks for spotting 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 »

7.5.1. Parameter Functions (setParameter)
These parameter names can be optionally followed by a digit (2 or 3)
Download updated. Now there's an optional parameter to Joint::setParameter called 'axis'. This specifies the axis you want the parameter to apply to. Effectively it's the 2 or 3 following the parameter name, but without making the enum massive. The default value for this parameter is 1. I've also added the joint addTorque/Force stuff that I seemed to have missed out.

Hope that's OK.
User avatar
Troglodit
Gremlin
Posts: 160
Joined: Tue May 25, 2004 2:18 pm
Location: Ukraine/Ternopil
Contact:

Post by Troglodit »

You have to make sure your geometries are in different spaces, or if they're in the same space, that you've got "internal collisions" switched on for that space.
Strange... When I created objects in the same space -- all works,
but in diferent spaces objects still do not collids.
setInternalCollisions(true); -- swiched.

Please help me to fix it:

Code: Select all

Entity* shashka_entity;
		shashka_entity=_mgr->createEntity("Shashka", "Cylinder04.mesh");
		shashka_entity->setCastShadows(true);
		
		SceneNode* shashka_node=_mgr->getRootSceneNode()->createChildSceneNode("Shashka");
		shashka_node->attachObject(shashka_entity);
		shashka_node->setPosition(0,4,0);
		shashka_node->setScale(0.1,0.1,0.1);

		OgreOde::SimpleSpace* shashka_space= new OgreOde::SimpleSpace(_space);
		shashka_space->setInternalCollisions(true);
		shashka_space->setAutoCleanup(false);	
		//shashka_space->
		OgreOde::BoxMass shashka_mass(1.5,Vector3(1,1,1));

		OgreOde::Body* shashka_body = new OgreOde::Body();
		shashka_node->attachObject(shashka_body);
		shashka_body->setMass(shashka_mass);
		_bodies.push_back(shashka_body);
		_last_node=shashka_node;


		OgreOde::TransformGeometry* transformGeometry = new OgreOde::TransformGeometry(shashka_space);
		OgreOde::BoxGeometry* shashka_geometry = new OgreOde::BoxGeometry(Vector3(1.0,1.0,1.0));
		transformGeometry->setBody(shashka_body);
		transformGeometry->setEncapsulatedGeometry(shashka_geometry);
		shashka_geometry->setPosition(Vector3( 0,0,0));
		_geoms.push_back(shashka_geometry);
		_geoms.push_back(transformGeometry);
		//**************************************************************************
 ---- SKIP ----
 ---- SKIP ----
 ---- SKIP ----


		_apache_space = new OgreOde::SimpleSpace(_space);


//WHEN THIS STRING IS AVAIBLE - ALL WORKS....
//_apache_space= shashka_space;


		
		_apache_space->setInternalCollisions(true);
		_apache_space->setAutoCleanup(false);	

		// Create the physical body of the helicopter
		OgreOde::BoxMass apache_mass(1.5,Vector3(1.4,1.46,4.24));
		_apache = new OgreOde::Body();
		_apache_body_node->attachObject(_apache);
		_apache->setMass(apache_mass);

		_bodies.push_back(_apache);
		_last_node = _apache_body_node;

		// Create the geometry of the helicopter from several bits

		// Main body
		OgreOde::TransformGeometry* trans = new OgreOde::TransformGeometry(_apache_space);
		OgreOde::BoxGeometry* geom = new OgreOde::BoxGeometry(Vector3(1.4,1.46,4.24));		
		trans->setBody(_apache);
		trans->setEncapsulatedGeometry(geom);
		geom->setPosition(Vector3(0.013,0.014,1.052));
		_geoms.push_back(geom);
		_geoms.push_back(trans);
thank you
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

Strange... When I created objects in the same space -- all works,
but in diferent spaces objects still do not collids.
I had the same problem with an earlier version of OgreODE, I don't know if this has been fixed, but my solution was to change:

Code: Select all

void World::collisionCallback(void *data,dGeomID geom_a,dGeomID geom_b)
{
	if( dGeomIsSpace(geom_a) || dGeomIsSpace(geom_b) )
	{
		if(dGeomIsSpace(geom_a)) ((Space*)(dGeomGetData(geom_a)))->collide(data);
		else ((Space*)(dGeomGetData(geom_b)))->collide((Geometry*)(dGeomGetData(geom_a)),data);

		if(dGeomIsSpace(geom_b)) ((Space*)(dGeomGetData(geom_b)))->collide(data);
		else ((Space*)(dGeomGetData(geom_a)))->collide((Geometry*)(dGeomGetData(geom_b)),data);
    }
    else
	{
		((Geometry*)(dGeomGetData(geom_a)))->collide((Geometry*)(dGeomGetData(geom_b)),_collision_listener);
	}
}
to this (more or less directly from the ODE manual):

Code: Select all

void World::collisionCallback(void *data,dGeomID geom_a,dGeomID geom_b)
{
	if( dGeomIsSpace(geom_a) || dGeomIsSpace(geom_b) )
	{
		// Colliding a space with something
		((Space*)(dGeomGetData(geom_a)))->collide((Geometry*)(dGeomGetData(geom_b)),data);

		// Collide all geoms internal to the space(s)
		if (dGeomIsSpace(geom_a))
			((Space*)(dGeomGetData(geom_a)))->collide(data);
		if (dGeomIsSpace(geom_b))
			((Space*)(dGeomGetData(geom_b)))->collide(data);
    }
    else
	{
		((Geometry*)(dGeomGetData(geom_a)))->collide((Geometry*)(dGeomGetData(geom_b)),_collision_listener);
	}
}
This version also checks space/space rather than only geom/space and geom/geom.
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 »

This version also checks space/space rather than only geom/space and geom/geom.
The World::collisionCallback function has changed in this version of OgreOde it should do;
  • spaceA/spaceB
    spaceA/geomB
    geomA/spaceB
    spaceA internal
    spaceB internal
    geomA/geomB
Which should cover all eventualities. I think?
User avatar
DWORD
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 1365
Joined: Tue Sep 07, 2004 12:43 pm
Location: Aalborg, Denmark
Contact:

Post by DWORD »

monster wrote:Which should cover all eventualities. I think?
Looks right to me :)
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 »

@ Troglodit
I've just copied your code from above (from the line "Entity* shashka_entity;" to the line "_geoms.push_back(transformGeometry);") straight into the SimpleScenes_Crash.h source (just above the line that says "// Create a space for the helicopter to live in") and it works perfectly. I just had to change the "Cylinder04.mesh".

If I leave the line "_apache_space = new OgreOde::SimpleSpace(_space);" as-is then it works fine. If I change that to "_apache_space = shashka_space;" then (obviously) it doesn't collide because I then subsequently need to do "_apache_space->setInternalCollisions(true);" which makes everything OK.

Perhaps a stupid question, but you are using this latest version of OgreOde aren't you?
User avatar
Troglodit
Gremlin
Posts: 160
Joined: Tue May 25, 2004 2:18 pm
Location: Ukraine/Ternopil
Contact:

Post by Troglodit »

Perhaps a stupid question, but you are using this latest version of OgreOde aren't you?
hm... ups... :oops:
I dont think so...
latest file is 28.06.04 9:55.
I just download link from first page of this topic ... 3 days ago.

From where I must download it ?

I found ! This one :http://www.green-eyed-monster.com/OgreOde_Preview.zip ?
User avatar
IoN_PuLse
Goblin
Posts: 220
Joined: Mon May 31, 2004 5:54 am
Location: Canada
Contact:

Post by IoN_PuLse »

Cool, got the new version of OgreOde working with the latest CVS with no problems, and the mouse movement issue is gone :D (so have the OpenGL shadow duplications)

Anyways, the Landscape demo seems to not really work properly. Rendering-wise it's fine, but when I drive around the car seems to "drive" in to the terrain, and flip around and stuff, and eventually ends up upsidedown?

I'm thinking I have to compile something special into ODE, but how did it compile with no errors even though it's missing something?

edit - NM, I RTFM.
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 found ! This one...
That's the one.
I've also updated the first post in the thread to help people find the latest version!
edit - NM, I RTFM.
LOL! Yeah, you have to compile ODE with the special terrain collision primitive.
And everything's #ifdef'd out so that it'll still compile even if you don't want to muck about with ODE. It just won't (as you discovered) work quite correctly!
Brutha
Gnoblar
Posts: 18
Joined: Wed Oct 13, 2004 12:40 pm

Post by Brutha »

Did anyone make a Project File for the Preview for VC6 yet ?

If yes I can save my time :)
User avatar
thegame
Gnoblar
Posts: 23
Joined: Tue Aug 31, 2004 7:50 am

Post by thegame »

The OgreOde_Preview complied without a hitch with the new version of Ogre. I love the car controls now - it skids a lot :wink:

Anyway after modifiying ODE-0.5 to use the TerrainCallback collider everyhting compiles and the ode & opcode libraries are created successfully. But bulding the odeDLL sloution gives me this link error

Code: Select all

Linking...
LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification\par
collision_kernel.obj : error LNK2019: unresolved external symbol 
"int __cdecl dCollideTerrainCallback(struct dxGeom *,struct dxGeom *,int,struct dContactGeom *,int)" 
(?dCollideTerrainCallback@@YAHPAUdxGeom@@0HPAUdContactGeom@@H@Z) referenced in function "void __cdecl initColliders(void)" (?initColliders@@YAXXZ)
..\\lib\\oded.dll : fatal error LNK1120: 1 unresolved externals
seen this before ?
Linux Rocks!!!
User avatar
IoN_PuLse
Goblin
Posts: 220
Joined: Mon May 31, 2004 5:54 am
Location: Canada
Contact:

Post by IoN_PuLse »

Open Dynamics Engine for OgreOde
================================

In the following documentation $OGRE_TOP is the directory to which you have
extracted your Ogre distribution. This directory is normally named 'ogrenew'.
You must build ODE, as detailed in it's documentation, in this directory.

Also, $ODE_TOP refers to the top level directory to which you have extracted
ODE. For the current stable release, and assuming you are using the correct
OgreOde directory structure, this will be $OGRE_TOP/OgreOde/ode-0.5

Building ODE
------------

To use ODE with OgreOde I recommend that you compile it with the following
options (in config/user-settings) set;

PLATFORM=msvc
Rather than msvc-dll, when compiling with MSVC.
I don't think you should be compiling ODE as a dll?
User avatar
thegame
Gnoblar
Posts: 23
Joined: Tue Aug 31, 2004 7:50 am

Post by thegame »

Damn.... :oops:

EDIT : not quite. Well I didn't bother to create ode.dll this time and proceeded as usual. I get this linker error with OgreOde

Code: Select all

Linking...
   Creating library ..\..\lib\Release/OgreOde.lib and object ..\..\lib\Release/OgreOde.exp
ode.lib(collision_kernel.obj) : error LNK2001: unresolved external symbol "int __cdecl dCollideTerrainCallback(struct dxGeom *,struct dxGeom *,int,struct dContactGeom *,int)" (?dCollideTerrainCallback@@YAHPAUdxGeom@@0HPAUdContactGeom@@H@Z)
..\..\lib\Release/OgreOde.dll : fatal error LNK1120: 1 unresolved externals
and the OgreOde_demos*.exe ask for OgreOde.dll. I am sorry If I am missing something real obvious here but since I am new to the Windows Development Environment (which BTW sucks!), I am all at sea :cry: [/code]
Linux Rocks!!!
User avatar
thegame
Gnoblar
Posts: 23
Joined: Tue Aug 31, 2004 7:50 am

Post by thegame »

I have tried everything - Read a lot on DLLs n stuff, tried the dependency walker, looked thru the Ode source - but I could still not make out why I keep getting the linker error. Maybe someone would be kind enuff to give me OgreOde.dll with the Terrain Primitives :(
Linux Rocks!!!
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 »

Around line 66 of ode-0.5/ode/src/collision_std.h, just after where it says;

Code: Select all

int dCollideRayPlane (dxGeom *o1, dxGeom *o2, int flags,
		      dContactGeom *contact, int skip);
You should have added the function prototype;

Code: Select all

int dCollideTerrainCallback(dxGeom *o1, dxGeom *o2, int flags,dContactGeom *contact, int skip);
The function body, which the linker is complaining that it can't find, is in ode-0.5/contrib/TerrainCallback/dTerrainCallback.cpp and you need to copy this to ode-0.5/ode/src and add it to the ODE_SRC variable in ODE's makefile. I suspect it's this last step that you're missing.

You should have modified ode-0.5/Makefile so that the ODE_SRC variable is defined thus;

Code: Select all

ODE_SRC = \
	ode/src/array.cpp \
	ode/src/error.cpp \
	ode/src/memory.cpp \
	ode/src/obstack.cpp \
	ode/src/odemath.cpp \
	ode/src/matrix.cpp \
	ode/src/misc.cpp \
	ode/src/rotation.cpp \
	ode/src/mass.cpp \
	ode/src/ode.cpp \
	ode/src/step.cpp \
	ode/src/stepfast.cpp \
	ode/src/quickstep.cpp \
	ode/src/util.cpp \
	ode/src/lcp.cpp \
	ode/src/joint.cpp \
	ode/src/timer.cpp \
	ode/src/mat.cpp \
	ode/src/testing.cpp \
	ode/src/export-dif.cpp \
	ode/src/collision_kernel.cpp \
	ode/src/collision_util.cpp \
	ode/src/collision_std.cpp \
	ode/src/collision_space.cpp \
	ode/src/collision_transform.cpp \
	ode/src/dTerrainCallback.cpp \
	ode/src/collision_quadtreespace.cpp
And, BTW, Makefiles suck to the max! Put a tab instead of a space (or vice versa) and the whole thing breaks!

If you've done all this;
  • Check that the signature you added in collision_std.h is correct
    You shouldn't have touched dTerrainCallback.cpp, except to copy it into the right place. But check that it matches the prototype.
    Ensure that you've defined "PLATFORM=msvc", "PRECISION=SINGLE", "BUILD=release", "WINDOWS16=0", and "OPCODE_DIRECTORY=OPCODE" in ode-0.5/config/user-settings
    Do a make clean, and then a make ode-lib
Locked