Prevent spline up vector from flipping

I’m animating objects along splines and what I found as default behavior is that UE is flipping the Up Vector of a spline automaticly once the object turns “upside down”. (see image)

I see that I could specify Up Vectors in Blueprints for each point etc, but isn’t there a simple solution that just pervents this specific flip of direction?

I don’t know what code you’re using there, but this looks like the 180 flip problem you get with using some kind of set location.

Unless you use quaternions, things are always going to flip when you get to ±180, when setting rotation.

The only way round it, I found was to only ever add and subtract rotation.

1 Like

I’m using this code and setting rotation indeed. But isn’t there a way to prevent this flip? Or to influence how the up vector of a spline behaves?

I found out that its not realted to the ActorSetLocationAndRotatiuon because the Up Vector the spline is flipping at ±180 degrees.

I’m using some splines that get created from another App (Rhino) from a data table (see image)
Would I need to add Up Vectors here?

You’re right, set actor rotation is fine, if it’s coming from the spline, like that.

It does look like you have a data problem there. Maybe it’s Rhino that has the 180 problem.

EDIT: Thinking about it a bit more, Rhino could work fine with -360 to +360, but UE defintely doesn’t. You need to get your data between strictly between -180 to +180 ( less than, so 179.9999 )

1 Like

I’m not importing any up vectors from Rhino at the moment, only ‘spline points’ and ‘tangents at spline points’.

I could try to import them as well but not sure if thats the problem.

So the up vector is set automaticly by unreal to (0,0,1) right? How would you proceed if you want to animate a looping plane along a spline in unreal (where the plane is really upside down at the top of the loop and does behaves like in the first picture of the post?

With the spline you will only get a forward vector (direction along the spline), so you need another direction vector that’s perpendicular to build upon. In this case I took the forward vector of blueprint that holds the spline as a right vector, the splines direction at a given distance as forward and up is the crossproduct of both.

Since you are doing this with a circle, something like this might work:

This will only work in this case since this spline is essentialy 2D. It won’t flip unless X and Y cross:

Hierarchy for reference:

This, distributing volumes along a spline and building a BP that extends two splines in parallel are the only solutions I can think of right now. So ideas are more than welcome.

Anyways… Hope it helps.

1 Like