Page 1 of 1

Need some more help.. not sure what the problem is..

Posted: Sun Dec 10, 2006 8:55 am
by pinkman
I just finished adding the newton with IPhysics libraries to my project, and it compiles, no errors, but when the window opens, it closes automatically.. so, anyone know what could be wrong?

[edit]
I was commenting things out, and found that it was closnig cause of this line

IPhysicsEntity* terrainEntity = physics.addEntity(&terrain);

still though, i have no clue why. Hope you guys can help.

[EDIT 2]
I went through all my code cleaned it up, to double check that was the only problem, and turns out.. it is. :P

IPhysicsEntity* terrainEntity = physics.addEntity(&terrain);
seems to be the only thing closeing the application, I looked through the example in IPhysics on the terrain, and mine is pretty Identicle, accept wont work.. loads, no errors, closes, no error. :P

[edit 3]
was reading through a post... Nick_Japan responded to someone with same problem..
"@klikmaster: Does Irrlicht successfully load your mesh? If that's not the problem, it could possibly be that IPhysics is using the wrong vertex type, although I added support for all of them. What kind of mesh is your map.my3d? Are there lightmaps or any other FX like that? How big is it? IPhysics currently just uses Irrlicht defaults, so still 16 bit indices."

~"...is using the wrong vertex type..."

How do i change the vertex type? To see if it works? He doesnt say how anywhere in the topic.

=EDIT FINAL=
heh, too many edits.. x_x; Im using terrain..

// Create the Terrain scene node
scene::ITerrainSceneNode* terrainNode = smgr->addTerrainSceneNode("media/heightMap.jpg");
terrainNode->setPosition( core::vector3df(0,0,0) );
terrainNode->setMaterialFlag(video::EMF_LIGHTING, false);
terrainNode->setMaterialTexture(0, driver->getTexture("media/texture.jpg"));
terrainNode->setMaterialTexture(1, driver->getTexture("media/detailmap3.jpg"));
terrainNode->setMaterialType(video::EMT_DETAIL_MAP);
terrainNode->scaleTexture(1.0f, 20.0f);
vector3df terrainScale(40, 4.0f, 40);
terrainNode->setScale(terrainScale);

// create triangle selector for the terrain
scene::ITriangleSelector* selector = smgr->createTerrainTriangleSelector(terrainNode, 0);
terrainNode->setTriangleSelector(selector);
selector->drop();

// create collision response animator and attach it to the camera
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, camera, core::vector3df(60,100,60),
core::vector3df(0,0,0), core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();

// create SPhysicsTerrain
SPhysicsTerrain terrain;
terrain.terrainNode = terrainNode;
terrain.terrainScale = terrainScale;

// create Terrain entity
IPhysicsEntity *terrainEntity = physics.addEntity(&terrain);

thats my code up until where it crashes.

Posted: Sun Dec 10, 2006 6:30 pm
by ChrisC
just a quick guess but a heightmap isnt actually a mesh is it?

have you tried loading in say terrain.3ds or some such...?

Posted: Sun Dec 10, 2006 7:40 pm
by pinkman
Uh, that shouldnt matter, one of the IPhysics examples uses a heightmap. (im basically using the same code from that)..

Posted: Mon Dec 11, 2006 4:45 am
by pinkman
If anyone can help me here, itd be apprecieated greatly. ^_^' Please..

Posted: Mon Dec 11, 2006 1:49 pm
by Acki
Just for undestanding:
you don't use the height map, the height map is only used to create the terrain mesh, after this the hm is no longer used !!!

Maybe you have to use getMeshBufferForLOD(...), but I don't really know...

Posted: Mon Dec 11, 2006 2:46 pm
by pinkman
The example 2 in Iphysics is used just like im using mine, theres works..