Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Unity Mathematics #13

Open
provencher opened this issue Jul 13, 2023 · 2 comments
Open

Support for Unity Mathematics #13

provencher opened this issue Jul 13, 2023 · 2 comments

Comments

@provencher
Copy link

Just came across this repo, and it looks fantastic!
I've been in the process of more heavily investing in Burst optimizing static functions, and this package looks largely static to begin with.

Any chance it could leverage mathematics utilities and structs instead of the ones in the old math library, so that they could automatically be optimized using the compiler optimizations supported by the new math library?

@FreyaHolmer
Copy link
Owner

I'm really torn on this one, since it seems like, well, unity itself is torn between their old math structs vs the new ones. I don't know what I should do!

@provencher
Copy link
Author

Well with IL2CPP the new math library is pretty much equivalent to the old one, but some of the older components still require Vector3s and Quaternions, instead of float3 and quaternions, but you can easily cast between them.

Also, if you work with native arrays arrays of floatxs from the new library (starting with unity 2022.1), you can reinterpret cast between them and the vector equivalents at no cost. Burst works on static functions too now, so you can even make the whole thing burst optimized.

See here on burst support!
https://docs.unity3d.com/Packages/[email protected]/manual/docs/CSharpLanguageSupport_Types.html

In any case, this is just a feature request, I've found gains of up to 50% using burst optimized math over the traditional approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants