How to display mesh(gun) instead of Collision particle ?

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
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

I want to use a gun instead of a Particle.bmp in collision tutorials how can i do that? it should work similar to IBillboardSceneNode.

Now in the tutorial i am able to show a particle now i want to replace with a gun mesh how can I do that? Is there any command for mesh to behave like IBillboardSceneNode where i corresponds to camera.
Please let me know if I have to be still more clear in my question
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to display mesh(gun) instead of Collision particle ?

Post by CuteAlien »

You can try replacing the boxemitter with a meshemitter: http://irrlicht.sourceforge.net/docu/cl ... d5ee5a5161
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

scene::IMesh* Meshgun=smgr->addMeshSceneNode("gun.md2");
scene::IParticleMeshEmitter* ParticleEmit=smgr->CreateMeshWriter
There is something wrong in above code please correct me. I want to use CreateMeshEmitter
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

scene::IMesh* Meshgun=smgr->getMesh("gun.md2");
scene::IParticleMeshEmitter* PEm=createMeshEmitter(Meshgun, true,core::vector3df(0.0f,0.0f,0.0f),100.0f, -1,false,5,10,video::SColor(255,0,0,0),video::SColor(255,255,255,255),2000,4000,0);


Error 1 error C3861: 'createMeshEmitter': identifier not found
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to display mesh(gun) instead of Collision particle ?

Post by CuteAlien »

createMeshEmitter is a member-function of IParticleSystemSceneNode (same as createBoxEmitter).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

Thank you cuteAlien :) now I got cleared the error but still in this following code

Code: Select all

if(receiver.IsKeyDown(irr::KEY_LBUTTON))
                     {
                                   scene::IMesh* Meshgun=smgr->getMesh("gun.md2");
                                   scene::IParticleSystemSceneNode* PEm=smgr->addParticleSystemSceneNode();
                                   PEm->createMeshEmitter(Meshgun,false,core::vector3df(0.0f,0.0f,10.f),100.0f, -1,false,5,10,video::SColor(0,255,0,0),video::SColor(255,255,0,0),2000,4000,0);
                                
                        }

I can't see the gun in the screen :( instead some square Thing is getting emmited very thick(many).


How to decrease paricles its size , change angle of emission and color. and make gun visible

I am getting particles moving upwards. and gun is not getting visible. how to change the direction of particle emission?
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to display mesh(gun) instead of Collision particle ?

Post by CuteAlien »

Ok, sorry, I have misunderstood what that function does. I thought it allows to use meshes as particels, but I just read documentation and what it really does is export particle from the form of a mesh. So still normal particle, just the origin is different.

So I guess it's not possible to use meshes for particles, but it sounds like you don't want random guns flying around anyway. Can you maybe describe what it is you want to see exactly - maybe we can give another solution (like using an animator instead).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

Thats ok no problem :)

Please help me in this
What I need is I have a weapon displayed , now it should emit a particle/bullet so when it reaches a another mesh or animated character(say a human) I should be able to destroy that human.

How does this emission of particle happen Even if i use this cylinder

Code: Select all

 
 
                                scene::IParticleSystemSceneNode* CEm=smgr->addParticleSystemSceneNode();
                                scene::IParticleEmitter* em=CEm->createCylinderEmitter( core::vector3df(0,0,0), 20, core::vector3df(0,1,0), 10, false,
      core::vector3df(0.0f,0.06f,0.0f),   // initial direction
      80,100,                             // emit rate
      video::SColor(255,255,255,255),       // darkest color
      video::SColor(255,255,255,255),       // brightest color
      800,2000,0,                         // min and max age, angle
      core::dimension2df(10.f,10.f),         // min size
      core::dimension2df(20.f,20.f));        // max size
 
 
There is no change from the previous createMeshEmitter. I am not understanding what's going on
Last edited by chaiein on Tue Apr 17, 2012 8:49 am, edited 1 time in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: How to display mesh(gun) instead of Collision particle ?

Post by hybrid »

We have a number of examples in the SDK which cover exactly this. Please go through the demo source code and find the solution.
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

Sorry I did not find in the demo examples for my requirement. please send me link where i can find solution for my previous reply
CuteAlien
Admin
Posts: 9721
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: How to display mesh(gun) instead of Collision particle ?

Post by CuteAlien »

Uhm... just try shooting in the examples - I think it was the collision example - or maybe the demo itself (shooting is probably with space or left-key, not sure right now).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chaiein
Posts: 30
Joined: Wed Apr 11, 2012 6:51 am

Re: How to display mesh(gun) instead of Collision particle ?

Post by chaiein »

Ya I got that demo Thank you:)
Post Reply