Terrain collision

supermael

18-08-2010 09:32:55

Hello,
I've got a problem with the terrain in Critter... The collisions are not like they have to be. It seems happen when the terrain's worldsize and the terrain's size are not the same... When I set the worldsize and terrainsize to the same number (2^n+1) it works, but when I set them to 513 and 2000 for example, my application crashes.

Is there a solution for my problem ?

oggs91

18-08-2010 11:47:14

the createTerrain() function currently has some bugs
what i did:
open CritterRenderSystem.cpp in Critter build -> goto createTerrain()
change the pose Variable

NxOgre::Vec3 pose(terrain->getPosition());
pose.x = terrain->getPosition().x-(terrain->getWorldSize()/2.0f);
pose.y = terrain->getPosition().y+(maxHeight + minHeight) / 2.0f;
pose.z = terrain->getPosition().z-(terrain->getWorldSize()/2.0f);


this works for me =) gl&hf

supermael

18-08-2010 12:26:01

There is still an offset.. What are the terrainsize and worldsize you set ?

oggs91

18-08-2010 16:29:32


mTerrainGroup = OGRE_NEW Ogre::TerrainGroup(g->getSceneMngr(), Ogre::Terrain::ALIGN_X_Z, 129, 12000.0f);


also tried it now with 257 instead of 129, also ok

supermael

18-08-2010 16:34:22

Thanks it works !
Now, I've an other question. I use my keyboard to move a body in my physic world, and the camera follows this body, which is my main character. But, I think it's the friction, when I move the body, my screen "trembles"..
What can I do to resolve this problem ?

oggs91

18-08-2010 16:46:42

My Material:

mDefaultMaterial = mScene->getMaterial(0);
mDefaultMaterial->setRestitution(0.1f);
mDefaultMaterial->setDynamicFriction(0.9);
mDefaultMaterial->setStaticFriction(0.5);


try to scale your body and look what happens?
sry but i have no idea :D

supermael

18-08-2010 19:42:48

The capsule still move with jerk...

supermael

19-08-2010 09:45:59

I found the problem and fixed it, thank you !