int3 position;
if (position == new int3(1, 1, 1))
{
// Do the code
}
However, I start getting errors because for some reason this produces a bool3, rather than simply a bool. I have to write my own helper function to do this.
I personally think it makes a lot of sense to be able to implicitly convert a bool3 into a bool. However I can understand if for whatever reason you don’t agree.
If you don’t, can Unity please at least add a .or and .and properties? So at least I can go
int3 position;
if ((position == new int3(1, 1, 1)).and)
{
// Do the code
}
Thanks! I’ve been really enjoying the new mathematics tools, but this really bugged me.
In many cases, you shouldn’t be comparing vectors like that because of floating point error. Often you want something like math.distancesq(A, B) < 0.01f. Of course, there are also situations where equality is perfectly valid (eg if you’re setting the values directly from code or you have initial/sentinel values). But occasional little “bumps” like this in floating point code are good oppotunities to check your logic.