Problem using Irrlicht with ODE

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
hansmbakker
Posts: 41
Joined: Mon Feb 16, 2004 7:37 pm

Post by hansmbakker »

thanks for posting your missing code!

it's true that guest was inpolite, but he was right that you had forgotten to post some files

i'm going to test them now, i'm curious!
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

I made a main.cpp and DCollisionInterface object

Post by fred43 »

This is the main: (main.cpp)

#include "DPhysicsManager.h"

int main(int argc, char **argv) {


irr::IrrlichtDevice * device = createDevice(video::EDT_OPENGL,core::dimension2d<s32>(1024, 768));

video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* smgr = device->getSceneManager();
smgr->addCameraSceneNodeFPS();
device->getCursorControl()->setVisible(false);

// just put your 3ds scene filename in parameter (mine is pave.2ds)
scene::IAnimatedMesh* meshPlan = smgr->getMesh("pave.3ds");
scene::ISceneNode* node = smgr->addAnimatedMeshSceneNode(meshPlan);
IMesh* mesh=meshPlan->getMesh(0,255,-1,-1);
DCollisionInterface* entity=new DCollisionInterface(mesh,node);

DPhysicsManager* physicsmanager = new DPhysicsManager(device);
// this adds my terrain.. i didnt clean addEntity up so there are still unnecessary parameters... have a look at the code and you'll see...
physicsmanager->addEntity(entity, false, false, false);
// this creates a crate at the given position
physicsmanager->CreateBounceable(smgr, core::vector3df(0,10,0));

int lastFPS = -1;
while(device->run())
{
driver->beginScene(true, true, video::SColor(0,200,200,200));
smgr->drawAll();
driver->endScene();
int fps = driver->getFPS();
if (lastFPS != fps)
{
core::stringw str = L"Irrlicht Engine - Vertex and pixel shader example ["; str += driver->getName(); str += "] FPS:"; str += fps; device->setWindowCaption(str.c_str()); lastFPS = fps;
}
physicsmanager->updatePhysics();

}
}


This is the my own DCollisionInterface.h

#ifndef DCOLLISIONINTERFACE_H
#define DCOLLISIONINTERFACE_H


#include <irrlicht.h>


#pragma comment(lib,"irrlicht.lib")

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

class DCollisionInterface
{
public:
IMesh* mesh;
ISceneNode* node;
DCollisionInterface(IMesh* m ,ISceneNode *n);
IMesh *getMesh() {return mesh;}
ISceneNode *getSceneNode() {return node; }

};
#endif

This is the DCollisionInterface.cpp

#include "DCollisionInterface.h"

DCollisionInterface::DCollisionInterface(IMesh* m ,ISceneNode *n) {
mesh=m;
node=n;
}
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

Post by fred43 »

Unfotunately, a cube go throuh the mesh entity.

I don't know why...

Does someone know ?

Fred
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

Do you use a precomp. binary of ODE ? I had that problem when using a self-compiled version of ode...
Hardwarespecs in signatures suck !
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

Post by fred43 »

I compiled my ODE 0.5 on WinXp with the following settings in user-settings at the end of my message:
(some warning (specially in collision_trimesh_internal.h)). I recompiled it. But it is the same problem.

Sincerly,
Frederic

# ODE user settings: the following variables must be set by the user

# (1) the platform to use. this name should have a corresponding
# makefile.PLATFORM file. currently supported platforms are:
# msvc microsoft visual C/C++
# msvc-dll microsoft visual C/C++, create a DLL
# mingw minimalist GNU for windows
# cygwin cygnus GNU for windows
# unix-gcc GNU gcc on unix
# unix-generic generic unix compiler. you may need to edit the CC
# variable in makefile.unix-generic
# osx Mac OS-X, with the gnu compiler.

PLATFORM=mingw

# (2) the floating point precision to use (either "SINGLE" or "DOUBLE")

#PRECISION=SINGLE
PRECISION=DOUBLE

# (3) the library type to build (either "debug" if you are doing development,
# or "release" for the optimized library)

#BUILD=debug
BUILD=release

# (4) if you are using an old version of MS-Windows that has command line
# length limitations then you will need to set this to "1". otherwise,
# leave it at "0".

WINDOWS16=0

# (5) If you want to use the TriList (triangle mesh) geometry class, you must
# have the OPCODE library installed somewhere. If this is the case then
# uncomment the following variable and set it to point to the directory
# where OPCODE is installed (note that you must have already compiled
# OPCODE, ODE's build system will not do that for you).
# See http://www.codercorner.com/Opcode.htm for more information about
# OPCODE. A recent version of OPCODE is provided in the ODE distribution
# in the OPCODE subdirectory. This code was originally written for and
# compiled on windows, but it has been ported so that it should compile
# under unix/gcc too. Your mileage may vary.

OPCODE_DIRECTORY=OPCODE
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

Post by fred43 »

Something is strange in 3DS/IRRLICHT/ODE

I create a very simple 3DS file:
1) one triangle with its normal (going to the sky) and a texture. I call it : the ground

I have imported the .3ds file to an Irrlicht mesh. I used the usual setGeom function (given in the original bounce tutorial) to transform IRR mesh to ODE mesh.

I dropped a simple box up to the ground: it fells and bounce on the ground

2) I modify the .3ds file like this : I put another triangle next to the other one (the form a rectangle)
I dropped my boxes and the pass throug the ground and go to the infinite!!!
And I notice a strange thing: some boxes go slower when they pass through the ground !!!!

Could you help me ?


PS:
I noticed vertice and indexed for the ODE geom: (dGeomTriMeshDataBuildSimple)
1) 1 triangle
Index: 0
Index: 2
Index: 1
Vertice 0: 40 0 0
Vertice 1: -20 0 35
Vertice 2: -20 0 -35

2) 2 triangles (not the samae size that the one before but it does matter, doesn't it ?)

Index: 0
Index: 2
Index: 1
Index: 3
Index: 5
Index: 4
Vertice 0: -10 0 5
Vertice 1: -10 0 -5
Vertice 2: 10 0 5
Vertice 3: 10 0 -5
Vertice 4: 10 0 5
Vertice 5: -10 0 -5
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

Post by fred43 »

Hello erSitzt,

Thank you for your answer.

Could you tell me which release you are using with ODE ?

(I compiled my own library with mingw with the result I described in previous messages)
fred43
Posts: 6
Joined: Sat Sep 25, 2004 3:05 pm

Post by fred43 »

I have just try recomipling with cygwin and an ODE cygwin tresming release: it doesn't work anymore....

Has someone an idea ?
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

please try one of the binary releases of ode and test again...

And try using SINGLE Precision if you compile it yourself.
Hardwarespecs in signatures suck !
zola -

Post by zola - »

Yep use PRECISION=SINGLE instead of DOUBLE. I think it's mentioned somewhere in the docu that trimesh collision doesn't work with double.

And make sure You're deleting all old ode libs you have from previous compiles so you don't accidently link with these.

Try to tweak some of the simulation parameters
dWorldSetGravity(theWorld,0,-9.8f,0);
dWorldSetERP(theWorld,0.8f);
dWorldSetCFM (theWorld,1e-4f);
dWorldSetAutoDisableFlag (theWorld,1);
dWorldSetContactMaxCorrectingVel (theWorld,1.0f);
dWorldSetContactSurfaceLayer (theWorld,0.001f);
dWorldSetQuickStepNumIterations (theWorld, 7);

build more collision contacts so primitive objects don't fall through meshes
try 124 for example.

if objects are very fast, compared to the volume they have, collisions will be very inaccurate because ODE/OPCODE doesn't do continous collision tests.
for very fast objects you might want to build extra collision volumes (box/sphere) which you enable/disable as needed.

i hope this give you some ideas where to look.
Post Reply