collision response not working on invisible nodes[SOLVED]

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

collision response not working on invisible nodes[SOLVED]

Post by zillion42 »

Hi,

It's been a while since I last looked into these forums... Previously I found a pipeline for importing lightmapped geometry (using two seperate x files), optimal or not, it's an established pipeline for me... Right now I'm a little bit puzzled on how to make large interior scenes work good.
So far i just added all my geometry to the octree scene manager like so:

Code: Select all

archinode = smgr->addOctTreeSceneNode(newFinalMesh->getMesh(0));
and used a seperate collision geometry for my collide mesh using a triangle selector, a collision response animator and a FPS camera, just like in the quake tutorial...

Code: Select all

selector = smgr->createOctTreeTriangleSelector(collide->getMesh(0), collidenode, 128);
collidenode->setTriangleSelector(selector);
selector->drop();

scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0, 200.0f, 200.0f, -1, 0, 0, true);

scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, camera, core::vector3df(5,75,5), core::vector3df(0,-2,0), core::vector3df(0,80,0));
camera->addAnimator(anim);
anim->drop();
so one problem I face is that the collidemesh is visible and z-fighting with my real geometry... So I could set it to POINTCLOUD... but seriously that is a workaround... Is there a solution ? As soon as I:

Code: Select all

collidenode->setVisible(false);
the collision stops working... Any suggestions on howto make the collide invisible but still keep colliding would be very welcome...
Last edited by zillion42 on Sun Dec 21, 2008 2:12 pm, edited 1 time in total.
roelor
Posts: 240
Joined: Wed Aug 13, 2008 8:06 am

Post by roelor »

make it fully transparant?
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

somehow that's what I would consider another workaound...
thx anyway...
Mel
Competition winner
Posts: 2293
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Post by Mel »

You even don't need 2 separate meshes. Anyway, try this, create a black texture, full black, use it as your main material on the collision parts of your stage, and then, put the blend of the material containing that texture in additive, your walls should dissapear, To ensure no Z problems, disable the Z-writting flag in that material, and you're done.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

ok, i give up... that would be same as roelor suggested, in other terms,
make it transparent.
I know that I don't need 2 meshes for lightmaps, ie. .b3d would handle it in 1 mesh but it's all a question of the export pipeline and the 3d package you're using, isn't it.
anyway thx all
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

or you can just make the collision by yourself.
if you check the code of collisionresponseanimator, you can copy from there.
and it wont stop working when you set the visibility to false.
Image
Image
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

i tried understanding that code but frankly to do that I would need much more time, if able at all...
I will try using irrnewt to see how things are over there...
DarkzideGames
Posts: 2
Joined: Wed Dec 17, 2008 5:50 am

Re: triangle selector, collision response and invisible node

Post by DarkzideGames »

zillion42 wrote:Hi,

It's been a while since I last looked into these forums... Previously I found a pipeline for importing lightmapped geometry (using two seperate x files), optimal or not, it's an established pipeline for me... Right now I'm a little bit puzzled on how to make large interior scenes work good.
So far i just added all my geometry to the octree scene manager like so:

the collision stops working... Any suggestions on howto make the collide invisible but still keep colliding would be very welcome...
The solution is simple. Don't create a scene node for collision. instead when createing the selector pass the scene and your collision mesh. There is no rule that says the mesh in a traingle selector has to be the same as the mesh of the scene node.

Here is your code again with my changes.

Code: Select all

//no more collidenode
archinode = smgr->addOctTreeSceneNode(newFinalMesh->getMesh(0));
selector = smgr->createOctTreeTriangleSelector(collide->getMesh(0), archinode , 128);
archinode ->setTriangleSelector(selector);
selector->drop(); 
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

wow... that is nearly to simple to believe... DarkzideGames, Thank You.
Post Reply