How can I attach a particle system to a node?

Problems building or running the engine, queries about how to use features etc.
Post Reply
r0ut
Halfling
Posts: 44
Joined: Mon Feb 22, 2021 6:25 pm
x 2

How can I attach a particle system to a node?

Post by r0ut »

Ogre Version: 1.12

The title is self explanatory. I have a ParticleSystem and I want to attach it to my node. It was possible using Mogre, but I couldn't find any example of how to do it with ogre itself
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: How can I attach a particle system to a node?

Post by sercero »

Particle Systems are movable objects, so it is just a matter of attaching it to the node:

Code: Select all

Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node");
node->attachObject(particleSystem );
References:
https://ogrecave.github.io/ogre/api/1.1 ... ystem.html
https://ogrecave.github.io/ogre/api/1.1 ... _node.html
r0ut
Halfling
Posts: 44
Joined: Mon Feb 22, 2021 6:25 pm
x 2

Re: How can I attach a particle system to a node?

Post by r0ut »

It throws me an error that I can't convert a ParticleSystem to a MovableObject. I'm using the C# bindings btw
User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 449
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 156

Re: How can I attach a particle system to a node?

Post by sercero »

Ogre::ParticleSystem inherits from Ogre::MovableObject so it should work.

Isn't there a cast operator for C#?

Perhaps the problem is that it is using multiple inheritance...

Check the graph here:
https://ogrecave.github.io/ogre/api/1.1 ... ystem.html
r0ut
Halfling
Posts: 44
Joined: Mon Feb 22, 2021 6:25 pm
x 2

Re: How can I attach a particle system to a node?

Post by r0ut »

I'll have a look on this and yes, C# doesn't support multiple inheritance :cry:
r0ut
Halfling
Posts: 44
Joined: Mon Feb 22, 2021 6:25 pm
x 2

Re: How can I attach a particle system to a node?

Post by r0ut »

The ParticleSystem class is inheriting from StringInterface only. I guess I will need to create another class with all the methods
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: How can I attach a particle system to a node?

Post by paroj »

ah, then indeed SWIG is stumbling over multiple inheritance. Does it help if you swap the parent classes here?
https://github.com/OGRECave/ogre/blob/5 ... stem.h#L65
r0ut
Halfling
Posts: 44
Joined: Mon Feb 22, 2021 6:25 pm
x 2

Re: How can I attach a particle system to a node?

Post by r0ut »

It does in my case! But I don't think it will work if you need something from StringInterface
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: How can I attach a particle system to a node?

Post by paroj »

then probably something like this is needed:
https://github.com/OGRECave/ogre/blob/8 ... #L685-L690
Post Reply