Can't do something when the particle touches to model

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
utkarsh
Posts: 3
Joined: Tue Jul 22, 2014 12:36 pm

Can't do something when the particle touches to model

Post by utkarsh »

At first i should tell you this is an awesome 3d gaming engine. I have tried your sample project named demo in visual studio and debugged it and ran it. I noted that when i clicked the particle was fired and when it colloid with wall it converts into smoke. And than i wondered can't the particle convert into smoke when it colloid with the girl walking between the portals. Please tell me how can i do some function when my particle colloids with the md2 model(girl). Thanks in advance
arnir
Competition winner
Posts: 154
Joined: Sat Jan 20, 2007 4:36 pm
Location: Czech Republic

Re: Can't do something when the particle touches to model

Post by arnir »

you need to add girl into triangle selector against which you are testing the ray collision
programmer is bad designer
designer is bad programmer
utkarsh
Posts: 3
Joined: Tue Jul 22, 2014 12:36 pm

Re: Can't do something when the particle touches to model

Post by utkarsh »

I know but i am not getting how to do that
Ruxify
Posts: 33
Joined: Tue Oct 16, 2012 12:37 am

Re: Can't do something when the particle touches to model

Post by Ruxify »

I don't know about the source code for that demo, but here's what you can do:

1. Create a meta triangle selector.

Code: Select all

IMetaTriangleSelector* tri_sel = smgr->createMetaTriangleSelector();
 
2. Get all the triangle selectors for each model and attach them to the node.

Code: Select all

ITriangleSelector* sel1 = smgr->createTriangleSelector(mesh1, node1);
node1->setTriangleSelector(sel1);
 
3. Then add it to the IMetaTriangleSelector:

Code: Select all

tri_sel->addTriangleSelector(sel1);
sel1->drop(); //Be sure to drop the selector after.
You can then use tri_sel or whatever you name the variable with the ray test functions in your code.
Note, I'm not 100% sure on this (so someone please correct me if I'm wrong), but if you have animated models you may need
to recreate the triangle meshes each frame. This is simply based on my experiences with triangle selectors.
Post Reply