I have setted up a scene with a moving node inside a bsp file and i added all the collision detection code and it works fine.
Now i added a static model to the scene and i want this model to be a part of the collision so that my moving node wont run tru it.
Any help on how i should add it?
Adding collision question
for code, see IrrLichtRPG 'levelmanager.cpp':
http://www.skyesurfer.net/keless/IrrLicht/RPG/
basically, in this aspect IrrLicht is pretty clunky. The only way to have multiple triselectors for use in collision detection is to have them grouped in an IMetaTriangleSelector (so far so good). So when you create your object, dont directly add your world's TriSel, just add an empty IMetaTriSel.
Now, once you've created your world, save a pointer to the TriSel you create from it. Also, for each object you create, save a pointer to its 'TriSelFromBB'.
When an object is created, you will create an IMetaTriSel with it that will be set as its selector. Then you need to add the TriSel of the level, and of all of the other entities to that IMetaTriSel. Do not add that entity's own TriSel to its MetaTS or it will collide with itself and movement will be choppy and bad.
When you want to delete an object, you need to remove its TriSel from all of the IMetaTriSelectors belonging to all the other entities before you remove it.
http://www.skyesurfer.net/keless/IrrLicht/RPG/
basically, in this aspect IrrLicht is pretty clunky. The only way to have multiple triselectors for use in collision detection is to have them grouped in an IMetaTriangleSelector (so far so good). So when you create your object, dont directly add your world's TriSel, just add an empty IMetaTriSel.
Now, once you've created your world, save a pointer to the TriSel you create from it. Also, for each object you create, save a pointer to its 'TriSelFromBB'.
When an object is created, you will create an IMetaTriSel with it that will be set as its selector. Then you need to add the TriSel of the level, and of all of the other entities to that IMetaTriSel. Do not add that entity's own TriSel to its MetaTS or it will collide with itself and movement will be choppy and bad.
When you want to delete an object, you need to remove its TriSel from all of the IMetaTriSelectors belonging to all the other entities before you remove it.
a screen cap is worth 0x100000 DWORDS
hmm i still have a problem :X
You add the trisel from the boundingbox correct?, well I need to add the real model instead of its box because it will have to be possible to walk into that model (it has a door :p) and then the model will be moveable
btw do you have msn messenger? i would like to discuss this issue a little smooter
You add the trisel from the boundingbox correct?, well I need to add the real model instead of its box because it will have to be possible to walk into that model (it has a door :p) and then the model will be moveable
btw do you have msn messenger? i would like to discuss this issue a little smooter
okay, we can get the mesh "getMesh()" and we can attach an arbitrary trisel to a scene node "setTriangleSelector()"
we can simply create a new TriSel, and use "getTriangles" on the Mesh so that it is a TS for that mesh, then attach it to the scene node with setTriangleSelector().
Issues to worry about would be:
1) the transformation matrix of the TS should reflect that of the ISceneNode
2) the transformation matrix of the TS should then be updated whenever the ISceneNode is moved/changed
3) animated mesh scenes should update their TriSelector's to reflect the new arrangement of their mesh each frame (which might be expensive, i dont know)
So, it sounds like you'd have to create some custom classes (a custom scene node and maybe an animator to update the TS) if you wanted per-triangle collision detection.
we can simply create a new TriSel, and use "getTriangles" on the Mesh so that it is a TS for that mesh, then attach it to the scene node with setTriangleSelector().
Issues to worry about would be:
1) the transformation matrix of the TS should reflect that of the ISceneNode
2) the transformation matrix of the TS should then be updated whenever the ISceneNode is moved/changed
3) animated mesh scenes should update their TriSelector's to reflect the new arrangement of their mesh each frame (which might be expensive, i dont know)
So, it sounds like you'd have to create some custom classes (a custom scene node and maybe an animator to update the TS) if you wanted per-triangle collision detection.
a screen cap is worth 0x100000 DWORDS
from the descriptions, tokamak might help
from my understanding, it is possible also to sort of substitute in tokamak's collision detection. dunno if that helps you...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net