Hi, a little n00b question,
how do I add collision detection support to a custom SceneNode? Which interface(s) does the node need to implement? (The node contains a good number of triangles already organized in a tree.)
Thanks.
Custom SceneNode with collision
Hallo
I have implemented it in the following way :
(This is a code snippet and might not be optimised)
Hope it gives you some ideas. The code above will add the triangles in a custom node to a 'local' selector (which can be dropped later) and then in turn adds it to a meta selector (the 'world'). This allows for custom collision detection and searching.
Anton
I have implemented it in the following way :
(This is a code snippet and might not be optimised)
Code: Select all
// A global selector (World)
IMetaTriangleSelector *World;
// Declare a SMesh
SMesh Mesh;
// Declare a local triangle selector
ITriangleSelector *selector;
// _3DPlanes is a SMeshBuffer containing the triangles
Mesh.addMeshBuffer(&_3DPlanes);
selector = SceneManager->createOctTreeTriangleSelector(&Mesh, this);
setTriangleSelector(selector);
World->addTriangleSelector(selector); // add all the various mesh selectors to this meta selector
Anton
