gravity on a terrain

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
yo

gravity on a terrain

Post by yo »

i have been wondering how to make gravity on a terrain.

Befor any1 starts to scold me, i have SEARCHED, and i have also tried my exprinments and came up with either horrible/ no results........

ihe gravity for terrain doesn't work the same way as the gravity for q3 map, if it does then i missed the point on how it works, but i did my best and came up with bad results....

SO IF ANYONE HAVA WAY OF PUTTING GRAVITY, CAN U PLS SHOW ME AN EXAMPLE

thxs for helping me :wink:
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

Post by Conquistador »

The terrain tutorial has a collision response animator, is that what you're looking for? If you want *real* gravity, then try looking at a physics engine like ODE or Newton.
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
Lethedethius

A good Physics Engine

Post by Lethedethius »

Yo A real good physics engine is Novidex's
vanfossn
Posts: 3
Joined: Tue Jan 31, 2006 11:27 pm

Post by vanfossn »

Hey. In the terrain turtorial as referenced by conquistador the:

createCollisionResponseAnimator() method will allow you to implement the gravity. It is the fourth element passed to this method in the form of a core::vector3df())

Google that method and you will be money.
Jenny
Posts: 13
Joined: Mon Nov 21, 2005 1:58 am

hmmm

Post by Jenny »

Not sure but maybe they are having the same problems as me/
The collision for meshes is diff then that of terrian as one uses
createOctTreeTriangleSelector
and the other
createTerrainTriangleSelector
The terrian triangle selector works for crap for me and I fall into my terrian all the time and see huge gaps in my terrian when the camera is moved just right.

So I suffer with mesh terriains like the one below and everything works / But I sure would like to use detail textures with it..


IImage* iHeightMap = driver->createImageFromFile("../../media/map5.bmp");
IImage* iTerrain = driver->createImageFromFile("../../media/texture1.jpg");
IAnimatedMesh* iTerrainMesh = smgr->addTerrainMesh("iTerrainMesh", iTerrain,iHeightMap,
core::dimension2d< f32 >(8500.0f, 8040.0f), 25000.0f, core::dimension2d< s32 >(32, 32) );
//smgr->getMeshManipulator()->makePlanarTextureMapping(iTerrainMesh->getMesh(0), 0.00010f);
ISceneNode* iTerrainNode = smgr->addOctTreeSceneNode(iTerrainMesh);
iTerrainNode->setPosition(core::vector3df(-120100,-3700,-100110));

It seems you have to use the terrian system insted for the EMT_DETAIL_MAP to work . Like example below


ITerrainSceneNode* terrain = smgr->addTerrainSceneNode("../../media/map5.bmp");
vector3df ts(8000,8000,8000);
ts = vector3df(8000.0f, 100.0f, 8000.0f);
terrain->setScale(ts);
terrain->setMaterialFlag(video::EMF_LIGHTING, false);
terrain->setPosition(core::vector3df(-120100,-3700,-100110));
terrain->setMaterialTexture(0, driver->getTexture("../../media/texture2.bmp"));
terrain->setMaterialTexture(1, driver->getTexture("../../media/texture22.bmp"));
terrain->setMaterialType(video::EMT_DETAIL_MAP);
terrain->scaleTexture(30.0f, 30.0f);// tiles texture 0 and 1

I also would like to set the uv for each texture insted of setting the scale for both of them at one time/ kinda dont make any sense. You use one texture to set the detial and should be able to tile it to your likeing/ Then lay your overlay over top of that and scale it and tile it to your likeing but NOPE i dont see that either.

Anyway collision most certiantly isnt working the same between the two methods for me thats for sure.

Maybe someone has ideas to why
Im probably just missing something lol
Post Reply