Hey there,
In my game i am using irrlichts default collision using bounding boxes, unfortunately the camera seems to get stuck on the boxes even if its no where near the mesh, is this a bug or is there a way of defining the bounding box to the mesh surface?
Buggy irrlicht collision
Re: Buggy irrlicht collision
Please always give as much information as you can think about when asking for help. Screenshots, source-code, detailed explanations what your are doing or trying to do. There is a million things to do with collisions and bounding-boxes and meshes and right now you don't tell us enough ... I don't know so far what it even is you are doing.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: Buggy irrlicht collision
hahah you know that im doing collision though,
here some code:
but the camera get stuck in the bounding boxes even when its no where near the mesh
here some code:
Code: Select all
//add collision rigid body // needs more collision stuff
//FIX COLLISION
znode = smgr->addAnimatedMeshSceneNode(model);
znode->getMaterial(0).EmissiveColor.set(0,0,0,0);
if (model)
znode = smgr->addOctTreeSceneNode(model->getMesh(0));
scene::ITriangleSelector* selector = 0;
if (znode)
{
znode->setPosition(core::vector3df(0,0,0));
selector = smgr->createOctreeTriangleSelector(model->getMesh(0), znode, 128);
znode->setTriangleSelector(selector);
selector->drop();
}
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();
selectedSceneNode = 0;
lastSelectedSceneNode = 0;
Re: Buggy irrlicht collision
You can enable the display of boundingboxes with ISceneNode::setDebugDataVisible using EDS_BBOX.
But I don't see you using any boundingboxes in your code, to me it looks like you use an octree and a CollisionResponseAnimator. There are a few situations where the CollisionResponseAnimator will get stuck, but as I still don't know how your scene looks like I don't know how to give any hints. Really, I don't know what is on your screen from what you posted so far ... describe it... use screenshots! That code above is neither something I can compile nor is there any information about the models involve. For all I know you have simply stuck your camera in a box-model and now wonder why that works...
But I don't see you using any boundingboxes in your code, to me it looks like you use an octree and a CollisionResponseAnimator. There are a few situations where the CollisionResponseAnimator will get stuck, but as I still don't know how your scene looks like I don't know how to give any hints. Really, I don't know what is on your screen from what you posted so far ... describe it... use screenshots! That code above is neither something I can compile nor is there any information about the models involve. For all I know you have simply stuck your camera in a box-model and now wonder why that works...
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 1638
- Joined: Mon Apr 30, 2007 3:24 am
- Location: Montreal, CANADA
- Contact:
Re: Buggy irrlicht collision
I've just looked at your code and as CuteAlien mention, we don't have any idea what is the model your doing the collision with (by the way it's not a bounding box but a octree that you are using for the collision detection.). And if you are inside a bounding box the you are "stuck".
That method will not work perfectly if your intenst is to load the full level in the model and do collision directly on it. Tried on my side and the way the octree work is not designed to give accurate collision.
One way that worked for me and was accurate was to load multiples meshes composing your level in a meta selector and the doing the collision test over this.
For the collision to work the best, separate the mesh level like this:
Ground - One mesh
Walls - One mesh
Objects - One mesh per object
Create a triangle selector for for each of them and add them to the metaselector and then use the metaselector to check for collision.
That method will not work perfectly if your intenst is to load the full level in the model and do collision directly on it. Tried on my side and the way the octree work is not designed to give accurate collision.
One way that worked for me and was accurate was to load multiples meshes composing your level in a meta selector and the doing the collision test over this.
For the collision to work the best, separate the mesh level like this:
Ground - One mesh
Walls - One mesh
Objects - One mesh per object
Create a triangle selector for for each of them and add them to the metaselector and then use the metaselector to check for collision.