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

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
pinkman
Posts: 25
Joined: Sun Dec 10, 2006 3:04 am

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

Post 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.
ChrisC
Posts: 37
Joined: Sun Dec 03, 2006 6:47 am

Post 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...?
pinkman
Posts: 25
Joined: Sun Dec 10, 2006 3:04 am

Post by pinkman »

Uh, that shouldnt matter, one of the IPhysics examples uses a heightmap. (im basically using the same code from that)..
pinkman
Posts: 25
Joined: Sun Dec 10, 2006 3:04 am

Post by pinkman »

If anyone can help me here, itd be apprecieated greatly. ^_^' Please..
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post 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...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
pinkman
Posts: 25
Joined: Sun Dec 10, 2006 3:04 am

Post by pinkman »

The example 2 in Iphysics is used just like im using mine, theres works..
Post Reply