I’m creating a series of nested torus meshes for use as intersection triggers, and I can’t seem to quite figure out why the inputs I’m passing in don’t have the expected results. Note how the green inner-most torus doesn’t even have a diameter larger than the 100-unit
star mesh, even though its’ diameter is specified to be 300 units:
You see in the screenshot that
-124.769: entered zone - Inner Systemfollowed by
127.213: exited zone - Inner System? That gives a hypothetical “thickness” value of
251.982, which although near to the expected value of
300, is something like 16% off of expected.
Here is the PG I’m trying all of this out in - I’m defining the torus diameter and thickness directly as they are passed into the call to
MeshBuilder.CreateTorus, but when I set up intersection enter/exit triggers that log out the position of the box at the time of the event, I’m finding that the actual numbers are nowhere near the expected figures.
Wait for about 10s or so after the PG loads and it will output the current location of the box and whether it is entering or exiting a particular zone. To help keep the math simple, I’m only moving along the x-axis.
For example, if I specify a torus diameter (
outerDiameter in the PG) of
800, I would expect that the intersection exit trigger would fire at
position.x >= outerDiameter, but instead it fires at
position.x = 503 or 584, etc… I expect some amount of inaccuracy from the maths but this is too large to ignore. Furthermore, when you take the difference between the entrance and exit positions, it should be equivalent (or close enough) to the
thickness parameter, but it’s not even close either.
I’m not sure why it would be involved, but somehow I feel the invisible hand of the constant
Math.PI / 2 ~= 1.57 at work. Maybe. I’m terribad at math, and it’s probably something simple and dumb that’s been staring at me in the face but needs someone elses’ eyes to see. It’s maybe even something unrelated to any sort of math issue. I dunno, that’s why I’m posting this question!
P.S. – the scales on the PG have been modified to try and highlight the discrepancies with the numbers