Working with terrain parameters <EDIT> Never Mind

capture

08-02-2008 01:26:30

I am trying to load a terrain into cake and drop some cubes on it, but i am having trouble. I am trying to use the ogre terrain file from the Ogre samples. I load the terrain with this code

mTerrainActor = mScene->createActor("terrain", new TerrainShape("terrain.png",100,"mesh-scale: 2 1 2"),Vector3(0, 0, 0), "static: yes");


But, this does not seem to be working correctly. When i mess with the scale or the 100 number i end up either making the cubes collide with the terrain above or below where the actually rendered terrain is.

What parameters should i be using for this terrain, or how would i find them out?

<edit>
Never mind. I have figured it out. The 100 is the height of the terrain. And the scale needs to be the PageWorld / PageSize.

Romep

08-02-2008 08:39:07

can you give your complete code? cause it doesnt work for me :(

capture

11-02-2008 00:02:26

yeah sure.


mSceneMgr->setWorldGeometry("terrain.cfg");

mTerrainActor = mScene->createActor("terrain", new TerrainShape("terrain.png",100,"mesh-scale: 2.9239766081871345029239766081871 1 2.9239766081871345029239766081871"),Vector3(0, 0, 0), "static: yes");


LOL, i am not sure if the decimal needs to be that long. But this is what works for me.

Arcanor

03-03-2008 21:30:46

yeah sure.


mSceneMgr->setWorldGeometry("terrain.cfg");

mTerrainActor = mScene->createActor("terrain", new TerrainShape("terrain.png",100,"mesh-scale: 2.9239766081871345029239766081871 1 2.9239766081871345029239766081871"),Vector3(0, 0, 0), "static: yes");


LOL, i am not sure if the decimal needs to be that long. But this is what works for me.


How did you come up with that long 2.92397... number?


EDIT: nevermind, you must have done something like 1500/513.

reptor

03-03-2008 22:24:45

If you have two numbers which are both known at compile time, and you need to calculate something using only those two known numbers, then the compiler will do the calculation for you. So just write 1500/513 (or whatever numbers you happen to have, of course) into the source code instead of some long number with lots of decimals.

betajaen

03-03-2008 22:27:26

1500/513 won't work in the String params, only in the class ones.

reptor

04-03-2008 12:58:24

You are right, I didn't look at the code enough to notice that.

Most often what I said is true, though. If it's not inside a string.