Blender-For-UnrealEngine-Addons icon indicating copy to clipboard operation
Blender-For-UnrealEngine-Addons copied to clipboard

Rotation/Twist problem with Spline Importing using "Copy Active spline for Unreal"

Open Michael4Numbers opened this issue 5 months ago • 7 comments

I'm getting a rotation/twist problem within Unreal when importing a spline using the Copy to clipboard function.

I've got a spline with 3 points I'm trying to import from Blender to Unreal. This is how it looks within Blender Image

However within Unreal, if I Visualize the Roll and Scale, I can see that the second point, while it has the correct tangents, does not have the correct rotation, causing it to twist.

Image

This is the values of the second point which leads me to assume the rotation is not being input at all.

Image

Any idea how I can fix this, unless it's a bug with the addon itself?

Michael4Numbers avatar Jun 07 '25 17:06 Michael4Numbers

Hello, I just see this issue post, sadly Blender and Unreal don't manage the twist in the same way, I will check and try to fix. Maybe you can also give me the blend file?

xavier150 avatar Jun 10 '25 08:06 xavier150

Unfortunately I do not have the blender file for this but this seemed to be the happening with any spline I make. Right clicking the spline in Unreal and clicking "Visualize Roll and Scale" would show that the actual rotation value of the spline was not written at all. The tangents were correct.

Michael4Numbers avatar Jun 12 '25 17:06 Michael4Numbers

Hello! sorry for the delay, It took time because I need to work on the next version of addon at the same time.

I was able to test in the new version and all seam to work without issue, the position and tilt is like in Blender. Maybe the issue come from a specific version of Blender or Unreal Engine? You use what version ?

https://github.com/user-attachments/assets/5e183b6d-a561-4b9e-8660-9b5393c019f8

xavier150 avatar Jun 16 '25 18:06 xavier150

Oh, very interesting. I am working with Unreal 5.4 and Blender 4.3.

Michael4Numbers avatar Jun 16 '25 21:06 Michael4Numbers

Here's the difference between the engine and blender. While it does rotate in Unreal. It doesn't follow Blender's actual rotation and twist.

https://github.com/user-attachments/assets/65fdba3b-f9b1-45e1-b13e-186dd7283d35

Here is the blend file I've used for this

SplineTest.zip

Michael4Numbers avatar Jun 17 '25 02:06 Michael4Numbers

Hey @Michael4Numbers Thanks for the file! I was able to reproduce the issue and partially fix it. I worked on it the full day. I think I'll finish the fix tomorrow. Image

About the roll Unreal don't support at roll bigger than 180 degrees between the points like Blender, but you easily fix it by adding more points. Also Blender API don't support true roll access from the API so you will have to use the twist method Z-Up to get the twist value.

Image

xavier150 avatar Jun 17 '25 19:06 xavier150

That's awesome to hear! I was already using Z-Up since I like it better for consistency. Can't wait to try out the fixed version! This addon has been incredible so far for my workflow!

Michael4Numbers avatar Jun 17 '25 19:06 Michael4Numbers

Hello @Michael4Numbers! It was was hard to understand all and it took time, but I was able to fix! The math behind is not perfect and I will have to do clean pass on the scripts but now it work a way better.

https://github.com/user-attachments/assets/002cb25d-4c73-4d7c-b4c3-aa8aa0992870

I will include the changes in the next update, I already pushed the changes in the Dev Branch if you want to test now https://github.com/xavier150/Blender-For-UnrealEngine-Addons/wiki/Download-And-Installation-From-Dev-Branch

xavier150 avatar Jun 19 '25 07:06 xavier150

Incredible work! The spline will look a bit funny in Blender when using Z-Up but it works like a charm in Unreal! Thank you so much for doing this!

https://github.com/user-attachments/assets/47e563d8-5302-4949-a79f-1c114b2bcd40

Michael4Numbers avatar Jun 19 '25 21:06 Michael4Numbers

Haha, I'm very glad all is working good now! :3 Since, I did some cleans and fixed bug in the Dev Branch, if you use the addon to export animations I recommend to use the last dev branch changes. I will close this issue now, enjoy dev on sonic!

xavier150 avatar Jun 20 '25 14:06 xavier150