OgreOde + terrain problem (with common TerrainSceneManager)

G30n3t!C

18-01-2009 21:40:01

Hi everybody,

I'm currently trying to get OgreOde and my Application working together.

I use the common TerrainSceneManager for my terrain geometry (setWorldGeometry) and want to apply simple physics like in the
OgreOde Basic Tutorial (http://www.ogre3d.org/wiki/index.php/Fi ... th_OgreODE) with the difference I want to use my
terrain geometry and not a simple plane.

For this purpose I looked at the code of landscape demo...

my steps are:
first: create my scene, which includes calling mSceneMgr->setWorldGeometry("Island.cfg");

second:
void GameState_Play_Core::initialiseOgreOde()
{
/************************************************************************/
/* Ogre Ode Implementation */
/************************************************************************/

mWorld = new OgreOde::World(mSceneMgr);
mWorld->setGravity(Ogre::Vector3(0,-9.80665,0));
mWorld->setCFM(10e-5);
mWorld->setERP(0.8);
mWorld->setAutoSleep(true);
mWorld->setAutoSleepAverageSamplesCount(10);
mWorld->setContactCorrectionVelocity(1.0);
mSpace = mWorld->getDefaultSpace();

const Ogre::Real _time_step = 0.5;
const Ogre::Real time_scale = Ogre::Real(1.7);
const Ogre::Real max_frame_time = Ogre::Real(1.0 / 4);
mStepper = new OgreOde::StepHandler(mWorld, OgreOde::StepHandler::QuickStep,
_time_step, max_frame_time, time_scale);

/************************************************************************/
/* OgreTerrain setup */
/************************************************************************/
/*
* values from Island.cfg
*/
Vector3 scale = Vector3::ZERO;
int nodes_per_side = 129;
int nodes_per_side_all_X = 0;
int nodes_per_side_all_Y = 0;
int worldWidth = 0;
int worldHeight = 0;
bool center = false;

mSceneMgr->getOption("Scale", &scale);
mSceneMgr->getOption("PageSize", &nodes_per_side);

if (scale == Vector3::ZERO)
{
// PageWorldX
scale.x = 3000 / nodes_per_side;
// MaxHeight
scale.y = 200;
// PageWorldZ
scale.z = 3000 / nodes_per_side;
}
worldWidth = scale.x * (nodes_per_side - 1);
worldHeight = scale.z * (nodes_per_side - 1);
nodes_per_side_all_X = nodes_per_side;
nodes_per_side_all_Y = nodes_per_side;

mTerrain = new OgreOde::TerrainGeometry(mWorld,
mSpace,
Vector3::ZERO,
nodes_per_side_all_X,
nodes_per_side_all_Y,
worldWidth,
worldHeight,
center);
}


but i get the error:
assertion "depthSamples >= 2" failed in
..\..\ode\src\heightfield.cpp:663

at runtime within the line
mTerrain = new OgreOde::TerrainGeometry(mWorld,
mSpace,
Vector3::ZERO,
nodes_per_side_all_X,
nodes_per_side_all_Y,
worldWidth,
worldHeight,
center);


it seems ode does not recognize my terrain in my mSceneMgr which it should take with mWorld = new OgreOde::World(mSceneMgr);
but why?

what am I doing wrong?
Honestly this are my first trys with ogreode, and don't have any experience with it
thx in advance

fzh

01-02-2009 13:20:35

May I know if your problem is fixed? I'm currently having the same problem, using shoggoth 1.6, latest ogreode from svn and ode 10.1, after adding in terrain, it will give me a depthsample > 2 assertion failure. The problem is in this function OgreOde::TerrainGeometry(...).

G30n3t!C

08-02-2009 11:11:54

sry for the late answer mate,

and no I haven't fixed this problem yet, I gave ogreode up in this project, because I only need simple collision detection,
so i took a look at this: http://www.ogre3d.org/forums/viewtopic.php?t=45267

maybe this helps u2, if your issue is, as mine is, simple collision detection

rhoelz

13-04-2009 03:18:11

I had this same problem; my solution was to link OgreOde against the single precision Ode libraries. I figured this out after adding some debugging printf statements to Ode and realizing that I was probably using dReal = float when Ode was compiled to think dReal = double, screwing up the call stack.

Let me know if this works for you!

fzh

26-07-2009 15:49:56

I had this same problem; my solution was to link OgreOde against the single precision Ode libraries. I figured this out after adding some debugging printf statements to Ode and realizing that I was probably using dReal = float when Ode was compiled to think dReal = double, screwing up the call stack.

Let me know if this works for you!


It's being quite busy recently and didn't have time to check this, tried this just now, and yes, it works now after linking the ode_single lib, thank you so much.

iisystem

03-10-2009 22:06:45

Hi,

I have the same problem with OgreOde. Ode is built as ode_single.lib, however. Is there any reasonable solution?

thanks!