Math differences with and without Burst

I have a job which does a bunch of maths for projecting a velocity vector on a hit normal (among a bunch of other things)

When this job is not bursted, the logic works exactly as expected. When it is bursted, the velocity gets projected all wrong

There is a lot of code in there so it’s not clear where I should start in order to find the culprit. Does anyone know of any math functions that behave differently when bursted? Any gotchas I should know about?

Float precision is less accurate even with high precision mode enabled. Has caused me all sorts of headaches when trying to do very precise comparisons (e.g. does a point lie on line).

2 Likes

Thanks, that was it

Adding this solves it in my case, although I might try to dig deeper:

 [BurstCompile(FloatPrecision.High, FloatMode.Default)]
1 Like