[Solved] Car follows through the Terrain

Dirso

27-05-2007 00:47:07

Hi,

I'm using DotSceneOctree and I had a problem with the terrain.

1) I created the world and the scene NxOgre
2) I loaded the .scene file using setWorldGeometry
3) I created a *body that will be a body of a car

Code:
_world = new NxOgre::World("FrameListener: Yes, log: text");
_scene = _world->createScene("RacingGame", mSceneMgr, "floor: yes, gravity: 0 -9.8 0");
_car = new CarUSC("Flame.car", Ogre::Vector3(0,100,0), _scene);
mSceneMgr->setWorldGeometry(Ogre::String("NewLA_track.scene"));

my CarUSC constructor:
Code:
mBodyCar = mScene->createBody(_car.carMesh, new NxOgre::CubeShape(1,1,3),
Ogre::Vector3(0,100,0), "mass: 1000");
mBodyCar->setCMassOffsetLocalPosition(Ogre::Vector3(0,-1,0));


But the car follows through the "ground". What am I missing?

Thanks,
Dirso.

I don't see any code that sets up the physics representation of your scene.
How do I do that? I thought loading the terrain geometry (setWorldGeometry) everything should be fine. What do I do?

betajaen

27-05-2007 00:57:37

Terrain?

mActor = mScene->createActor("terrain", new TerrainShape("file name of the terrain", 4096, 150, 513,513), Vector3::ZERO, "static: yes");

If you spent one week trying to get this working, then it's obvious you didn't read my working with 0.9 thread or even browsed what classes there are.

Also why on earth is your second car mesh a static body? You know it won't move.

Dirso

27-05-2007 02:36:05

The mesh I use for the terrain is already loaded by the setWorldGeometry. What can I do? Can I use DotSceneOctree with NxOgre? That's my main problem. I'm totally lost. May I create an actor from a pre-loaded node?

Thanks,
Dirso.

Dirso

27-05-2007 04:14:01

Terrain?

mActor = mScene->createActor("terrain", new TerrainShape("file name of the terrain", 4096, 150, 513,513), Vector3::ZERO, "static: yes");

If you spent one week trying to get this working, then it's obvious you didn't read my working with 0.9 thread or even browsed what classes there are.

I think I have to read that thread again, but looks like that I miss just what I need.


Also why on earth is your second car mesh a static body? You know it won't move.

I didn't put the second car on this code. It was garbage from one of my tests.

I can't understand why it's been so hard... I just need to have a mesh as the terrain, nothing else. I'd like to use DotSceneOctree plugin becuse it will make my game faster - I was told - but if needed, I'll remove it.

Please, help me!
Dirso.

betajaen

27-05-2007 10:50:17

The terrain may be loaded by setWorldGeometry, but it doesn't mean NxOgre knows about it, and if it did, what to do with it. That's what that Actor with the TerrainShape is for.

Dirso

27-05-2007 12:43:10

So, it looks like I can't use dotsceneoctree with nxogre, that's ok for now.
The terrainshape only allows images, right? For a mesh what should I use? For My body car, I have a mesh, should I still use the CubeShape? It loads ok my car, so what the dimensions works for?
If you have an idea how to use dotsceneoctree with nxogre, I'll be really thankful!!!

Thanks,
Dirso.

betajaen

27-05-2007 12:54:53

dot scene octree is just a collection of organised meshes? Can't you just get the list of them, and manually put them in?

daedar

27-05-2007 13:03:09

basically, dotscene is just an XML definition to store scene's properties. I'm using .Scene for my project and modified a little bit the parser so that you can add physics informations to the XML file.

For the terrain you should really use either PLSM2 or the basinc Ogre's TerrainManager, that's really faster than Octree (LOD, Occlusion,...) and use the terrain shape from NxOgre.

Dirso

27-05-2007 14:19:52

My main problem is I have a mesh as the terrain and every single scene manager I could use, throws exceptions when I try to load this mesh as the worldGeometry, and I really don't know what to do.

@betajaen:
It's just a xml, I could even not use it. But if I remove this mesh from the .xml, will the .bin pre-processed file be loaded?

Dirso

27-05-2007 16:02:41

I removed the node and I create it as a MeshShape and looks like everything is OK, but I have too many polygons, so it looks like the Octree is not working. I'll try it out later.

betajaen

27-05-2007 16:22:28

Octree does nothing to NxOgre. You should disable parts of the Mesh like Octree does, depending on the location of the Camera.

This sort of thing can't be solved with a one line piece of code. Streaming physic meshes in and out for frame-rates and efficiency is a complicated subject.

Dirso

27-05-2007 16:31:42

Octree does nothing to NxOgre. You should disable parts of the Mesh like Octree does, depending on the location of the Camera.

This sort of thing can't be solved with a one line piece of code. Streaming physic meshes in and out for frame-rates and efficiency is a complicated subject.


I understand. Thank you very much for your help.
Dirso