Mesh Orientation, forward and top vector control on Spline path

Hello!

What is the logic and approach I should use to get the forward vector of my particle mesh to follow a spline and to make the top vector of my mesh to face away from a point while following a spline path?

Example: I currently have a planet project and am trying to get the mesh orientation of my Niagara mesh particle to follow the path of the spline but have its forward vector completely following the spline path, while also having the top vector face away from the planet.

Main two things I am trying to understand using the Niagara System for my mesh particle
1.Forward vector
2.Up vector

This is currently what I was able to think up, It works perfect for the z-axis view but from any other axis view you can see where it falls short.



This is my first attempt at using Niagara and after days of searching I could not find anything online that is similar to the problem I have.

Any help or guidance would be hugely appreciated!

1 Like

You can sample both Forward Vector (Direction) and Up Vector in your Niagara Module and store the values as Particle Attributes so that you can access them in other Niagara Modules

Then you can use the Update Mesh Orientation build-in module to orient your mesh based on the sampled vectors, using the Orient To Vecotr(s) Method

The problem then is to make sure your spline-up vector is correct, in my example I’ve just drawn a spline around a sphere. As expected I get this result:


Some meshes on one part of the spline are aligned nicely but other parts aren’t.

If you want the particles’ up vector always facing away from the planet you can calculate it in Niagara if you move the Niagara System in your level to the center of the planet and then subtract that position from the particle’s position.

Add the particle’s position and the position of the emitter (Engine Emitter SimulationPosition) in your “Map Get” node, covert them to vectors, subtract one to the other and plug the result in a “Direction and Lenght Safe” node (to normalize the vector) and that’s going to be your new UpVector.
Do a cross product to get the right vector if you need that one as well

Result

5 Likes

This worked perfectly, Thank you for your valuable insight and assistance!

I also really appreciate the steps and pictures you took the time to setup up. It was very clear, concise and easy to follow! <3

Same here. The first part of you answer helped me to make a conveyor factory line with mehses