Emitter Origin in Niagara

niagara
ue4
unreal

#1

Hi everyone,

Been banging my head against a brick wall with this one, so thought I’d see if anyone could point me in the right direction :slight_smile:

I’ve got a Niagara system with two emitters. I need to change the origin of the second emitter along the Z axis. In Cascade it was as simple as updating the Emitter Origin, but can’t for the life of me figure out how to do this in Niagara. I’ve tried picking apart the Expression Example in the Niagara example map, but my lack of coding knowledge (HLSL or otherwise) is proving to be a hinderance…

The red arrow shows where the second emitter is currently spawning - I need it to spawn at the top of the beam (where the green arrow is).

This is the closest option I could find in the example files - except I don’t want it to move along a sine during update - hoping to set a static offset at spawn.

This was what I came up with - putting the simulation position into a vector, then using an expression to add a value via float 3 (Z axis). Absolutely no experience with HLSL, so I’ve likely got something wrong there. Any suggestions would be greatly appreciated :slight_smile:


#2

I was confused by the lack of emitter transform as well when I started with Niagara, but things kind of worked out fine with just adjusting the sphere/box location offset under Particle Spawn. Is there a reason that wouldn’t work for you?


#3

Hi Chris,

Unfortunately that won’t work in this case. For some context, this is the effect I’m working on:

https://realtimevfx.com/t/joyce-sketch-18-hologram-wip/6611

I’m adding a ‘boot up’ effect before the sphere and hologram appear (using a second emitter). I can easily change the position of the sphere, but because I’m caching out the position of the mesh at spawn (and can’t for the life of me figure out how to tell Niagara to offset the mesh starting position either), moving the sphere still leaves the mesh transition in the wrong location. As the sphere and mesh are correctly aligned in the first emitter, thought it would be better to simply move the entire emitter in the Niagara system…


#4

As for offsetting the static mesh starting position, all you should have to do is make a little edit to the Sample Static Mesh module!

If you double-click the module (or right-click it and choose Open and Focus Asset), you’ll be presented with the following view

Click the lil’ plus on the Map Get node, and add a new Vector parameter. Name it Module.Offset, and hook it up like this

The idea is to add our new offset value to what’s being written as the MeshPosition.

After compiling and saving your changes, you’ll see your new parameter added to the module interface. Type in your offset or hook it up to another parameter, either one should give you the results you’re looking for!


#5

Ah ha, that’s got it! :smiley:

As I was using a custom module rather than sample skeletal mesh it took a bit of tweaking, but that’s definitely solved the problem.

Thanks for the help and handy screenshots Chris! :slight_smile:


#6

Ah my bad, I totally missed that you weren’t using the static mesh sampler… but I’m glad you got it figured out regardless!