DanielH
05-04-2008 19:21:21
Hello!
Today I have tried using bleeding but I got more problems than I was expecting.
For example, I'm using this code below to create a cube.
Body* b = m_scene->createBody("cube.1m.mesh", new NxOgre::Cube(2),
NxOgre::Pose(m_cameraController->getCamera()->getPosition(),
m_cameraController->getCamera()->getOrientation()), ActorParams("mass: 10"));
It worked great in 0.9 (slightly different but mostly the same), but in bleeding the model is placed at (0, 0, 0) wherever the camera is at the moment the cube is created. It doesn't seem to move at all eighter.
What am I doing wrong?
betajaen
05-04-2008 19:28:01
Body* b = m_scene->createBody("Cube;cube.1m.mesh", new NxOgre::Cube(2), NxOgre::Pose(m_cameraController->getCamera()->getPosition(),
m_cameraController->getCamera()->getOrientation()), ActorParams("mass: 10"));
DanielH
05-04-2008 19:43:14
Fast as always, betajaen
It still get's spawned at (0,0,0) however. It seems the simulation isn't running, hence the Node pose is never updated.
If it's any help, here is how I initialize NxOgre:
m_world = new NxOgre::World("log: html, timecontroller: ogre");
m_world->createDebugRenderer(m_sm);
SceneParams sp;
sp.setToDefault();
sp.mController = SceneParams::CN_ACCUMULATOR;
sp.mGravity = NxVec3(0, -9.82f, 0);
sp.mRenderer = SceneParams::RN_OGRE;
m_scene = m_world->createScene("Main", sp);
betajaen
05-04-2008 19:51:55
It's "time-controller".
All Parameters in NxOgre follow this pattern.
C++ = mLongNameIsntIt
Param String = long-name-isnt-it
DanielH
05-04-2008 19:53:20
A quick test after my last post confirmed that the physic simulation didn't run. Do I have to do this manually in bleeding? Didn't find any calls to simulate in Cake.
bool GameApplication::frameStarted(const Ogre::FrameEvent& evt)
{
if(m_window->isClosed())
return false;
m_world->simulate(evt.timeSinceLastFrame);
// OR
m_world->getPhysXDriver()->simulate(evt.timeSinceLastFrame);
//....
betajaen
05-04-2008 19:55:40
No. Assuming you have the time controller using Ogre, it will create the framelistener and inject time for you. If you don't, then it's up to you to use your own time controller.
But this is how I setup NxOgre in Cake Bleeding:
mWorld = new World("time-controller: ogre");
mScene = mWorld->createScene(
"Eddie",
"renderer: ogre, controller: accumulator, gravity: yes"
);
DanielH
06-04-2008 15:08:15
Thanks, works like a charm!
Now I'm just wondering about the terrain. How come the feature to load terrain from a grayscale image has disappeared? I thought that was a brilliant simple way to do it. I really don' like the way you now have to bake the heightmap with flour.
betajaen
06-04-2008 15:21:03
The old code relied on Ogre to read in the image for you. I'm slowly moving away from the Ogre functions and compartmentalsing the others I can't avoid for NxOgre 1.5; so NxOgre can be used with other rendering systems.
Anyway; I designed the ManualHeightfield so if you wanted to; you could write a image to heightfield function yourself. Just like how Flour does it. Besides it's quicker to pre-cook the heightfield and load it in rather do it in mid-frame.