Collision Detection
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
Collision Detection
How would you use collision detection so that something besides the camera is being collided with.
(such as a third-person camera wanting the sydney model its following to collide with terrain and not itself)
I've tried all I can think of and read and read and read...please post some help.
(such as a third-person camera wanting the sydney model its following to collide with terrain and not itself)
I've tried all I can think of and read and read and read...please post some help.
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
-
- Posts: 11
- Joined: Sat Jul 15, 2006 5:42 am
It's nice if you would tell us how you solved it
Compete or join in irrlichts monthly screenshot competition!
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
Blog/site: http://rex.4vandorp.eu
Company: http://www.islandworks.eu/, InCourse
Twitter: @strong99
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
Code: Select all
ISceneNodeAnimator* anim = sm>createCollisionResponseAnimator(
selector, pcam, vector3df(30,51,30),
vector3df(0,-8,0),
vector3df(0,0,0));
pcam->addAnimator(anim);
anim->drop();
-
- Posts: 11
- Joined: Sat Jul 15, 2006 5:42 am
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
-
- Posts: 11
- Joined: Sat Jul 15, 2006 5:42 am
Code: Select all
scene::ISceneNodeAnimator* anim =
app_scene_manager->createCollisionResponseAnimator(
NULL, player, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
player->addAnimator(anim);
anim->drop();
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
Code: Select all
ITriangleSelector* selector = sm->createTerrainTriangleSelector(terrain, 0);
terrain->setTriangleSelector(selector);
Code: Select all
ITriangleSelector* selector = smgr->createOctTreeTriangleSelector(
yourlevelmesh->getMesh(0), q3node, 128);
yourlevelnode->setTriangleSelector(selector);
selector->drop();
EDIT : Be sure to add it above the code I posted above.
-
- Posts: 11
- Joined: Sat Jul 15, 2006 5:42 am
Ok i got it working. Only problem is , the clipping is all messed up with the level. When i ran the collision detection tutorial, with the camera, everything was fine. Here is what i mean :
http://img443.imageshack.us/img443/3484/ssvr7.jpg[/url]
http://img443.imageshack.us/img443/3484/ssvr7.jpg[/url]
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
Post your code one more time with the selector you included please
EDIT
It should be similar to this
EDIT
It should be similar to this
Code: Select all
ITriangleSelector* selector = smgr->createOctTreeTriangleSelector(
yourlevelmesh->getMesh(0), yourlevelnode, 128);
yourlevelnode->setTriangleSelector(selector);
selector->drop();
scene::ISceneNodeAnimator* anim =
app_scene_manager->createCollisionResponseAnimator(
selector, player, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
player->addAnimator(anim);
anim->drop();
-
- Posts: 11
- Joined: Sat Jul 15, 2006 5:42 am
Code: Select all
scene::ITriangleSelector* selector = 0;
selector = app_scene_manager->createOctTreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(selector);
selector->drop();
//level->setMaterialFlag(EMF_LIGHTING, false);
q3node->setPosition( vector3df(-1300,-144,-1249) );
q3node->setScale( vector3df(2, 1, 2) );
q3node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
//level->setMaterialType(EMT_NORMAL_MAP_SOLID);
scene::ISceneNodeAnimator* anim =
app_scene_manager->createCollisionResponseAnimator(
selector, player, core::vector3df(30,51,30),
core::vector3df(0,-8,0),
core::vector3df(0,20,0));
player->addAnimator(anim);
anim->drop();
-
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
whats app_scene_manager, thats the only thing I see that could possibly be out of place.Invictus1017 wrote:Code: Select all
scene::ITriangleSelector* selector = 0; selector = app_scene_manager->createOctTreeTriangleSelector( q3levelmesh->getMesh(0), q3node, 128); q3node->setTriangleSelector(selector); selector->drop(); //level->setMaterialFlag(EMF_LIGHTING, false); q3node->setPosition( vector3df(-1300,-144,-1249) ); q3node->setScale( vector3df(2, 1, 2) ); q3node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true); //level->setMaterialType(EMT_NORMAL_MAP_SOLID); scene::ISceneNodeAnimator* anim = app_scene_manager->createCollisionResponseAnimator( selector, player, core::vector3df(30,51,30), core::vector3df(0,-8,0), core::vector3df(0,20,0)); player->addAnimator(anim); anim->drop();
Getting collide with enemy
hi sorry to use your thread...
I have the same problem but not yet solved?
I added the mapsector of envrionment and enemies to metasector..
and i createated CollisionResponseAnimator for that.. my player is not colliding with enemy.. But if i made enemy to move it is coliding with my player.. i am not able to add this mapsector to that and that mapsector to this.. can any one help me..
I have the same problem but not yet solved?
I added the mapsector of envrionment and enemies to metasector..
and i createated CollisionResponseAnimator for that.. my player is not colliding with enemy.. But if i made enemy to move it is coliding with my player.. i am not able to add this mapsector to that and that mapsector to this.. can any one help me..