collistion using octtree

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
mataanjin
Posts: 19
Joined: Tue May 25, 2010 3:07 am

collistion using octtree

Post by mataanjin »

i have been using bounding box for collision detection.
but i have problem when my object move around, the collision is wrong, maybe because it's using aabb algorithm.

this is my collision code

Code: Select all

bool collision(scene::ISceneNode *other) 
	{ 
		if(colModel->getTransformedBoundingBox().intersectsWithBox(other->getTransformedBoundingBox()))  
			return true;
		return false; 
	}
.
.
.
irr::core::list<Obstacle*>::Iterator it = obstacle.begin();
					while(it!=obstacle.end() && flag == false) 
					{ 
						Obstacle *objek = *it;
						flag = player->collision(objek->colModel);
						++it;
					}
					if( flag == true )
						player->pos = before;
this code used so when my object intersect with other object i can't move forward any more.

how can i implement this using octtree?
the tut explain about using ray, but i want to use the mesh for collision detection. how do i know when a collision detected, so i can make the object stopped.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Example 7 also has the collision code for octrees - the camera cannot run into the castle mesh.
mataanjin
Posts: 19
Joined: Tue May 25, 2010 3:07 am

Post by mataanjin »

hybrid wrote:Example 7 also has the collision code for octrees - the camera cannot run into the castle mesh.
i know that.
but how can i use triangle instead of ray?
so i can check collision like using bounding box.

or is there a way to make a oriented bounding box?
Post Reply