Is it possible to set emitting space to something other than world or emitter?

Hello.
In our game we have a gameobject(object A) moving with constant velocity with a particlefx component attached, that has a large amount of emitters(over 20) with large amount of particles emitted(over 1000). Object A has a parent (Object R) which also moves with some speed. So, what is the best way to achieve effect when particles are emitted in local space of object R, not in world space or space of emitter attached to object A. Is it possible to set emitting space to something other than world or emitter?
Also since the speed of object R is not a constant value(but I can calculate it), I can not just set the initial speed of particles equal to the speed of object R, but maybe it is possible to change the speed of particles to be relative to the speed of objectR?

If I understand your setup correctly, can’t you parent the particlefx under R instead of under A instead?

Well, it seems like not a solution, because what i’m trying to achieve is kind of a trail that is left behind object A along its movement direction.

Usually I would just set emitting space to world to achieve this effect, but I need to emit particles in local space of object R, like if it was world space.

I understand. I have a few ideas, let me try it on my machine and see if it flies!

1 Like

Thank you, sir. I’m waiting.

No good solutions yet I’m afraid and it’s not looking too bright. The emission space (world/emitter) is handled in the engine’s particle simulation module which we can’t really control from script or shaders in a practical way.

Can you describe more what end result you are trying to achieve? Perhaps there is another way to do it other than “parent space”.

1 Like

Well, I can’t really describe a lot of details, but I can describe something like an abstract model which completely represents what I’m trying to achieve.

We have Root Object which contains a set of objects and one of these objects is moving. It has a particle effects that can be described as small pieces detached from object, they have constant speed and fading away alpha curve. This particle effect make a “trail” effect behind moving object.

For example Object with trail moves along X axis to the right and Root object moves along Y axis to the bottom. And I want to see a straight horizontal line made by particles behind my moving object, and this line moves with my Root object down along Y axis. But due to emitting in world space I won’t have a straight horizontal line it will be an arc or a diagonal line. However, I could have added velocity of Root object to the initial velocity of particles, but Root object is slowing down and accelerating based on user input, so it’s velocity can not be “precalculated”. I hope that you get the idea.

So, since there is no way to create such thing, maybe it is possible to create something that looks like this?

Not that I can think of at the moment no.

My first thought was applying the correct inverse transform to the world positions in the vertex shader in the particle material, but that would cause particles to spawn in “parent space” as well, instead of at the correct emitter position.

It sounds that a combination of using emitter space and tweaking emitter properties (lifetime, speed, size etc.) will be the most straight-forward way.

So, if we apply inverse transform as you say with a “offset” of local position of moving object, then we get an equivalent of emitter space, the particles will be spawned at emitter position and moved in emitter space?

I tried applying the parent inverse transform like I described locally on my machine, but in the engine a particle’s spawn space and simulation space are handled separately depending on the emission space setting. We can’t do that same distinction in the vertex shader, so there is no catch-all shader matrix magic that will solve the problem you have unfortunately.

I think your best bet for now is probably to use emitter space and fiddle with the emitter properties until you get something that you are satisfied with.

It’s an interesting problem though, I wonder how it could be solved nicely. Perhaps having something like EMISSION_SPACE_SOURCE and pointing to e.g. a gameobject or something like that.

1 Like

Yeah, having something like parent space for emitter would be really nice. It would also be great to have an ability to set particle initial velocity in vector3 format.

But I think tweaking emitter properties is not an option for me, I’ll better try to rearrange my objects or try some tricks using cameras.

Anyway thank you for your great support, Johan.

2 Likes