Download

Vector IsValid?

Is there a way to treat a Vector as Valid not just 0,0,0 ?

0,0,0 is valid. Can you be more specific?

Just wondering if it can be treated as if it had been set or not, just incase at any point it needs to be 0.

If you need to represent any vector including (0,0,0), then your invalid vector should be infinity (∞,∞,∞). In other words, the invalid vector’s x, y, & z coordinates should all be the largest representable value or a value you don’t intend to reach.

I’m taking your question as “how to know if a vector has been modified while allowing (0,0,0) as a valid value”. In that case, you would change the default value to something you don’t intend to have (same as what I said above). I’m assuming your possible values will be unbounded, so you would set the variable’s default value to infinity (i.e. the largest number you can use). Then, whenever you need to check if it’s changed (i.e. not default), you just check to see if it’s equal to infinity. Though, you really only need to test if x is infinity.

There’s no such thing as an “Invalid Vector”… Maybe you should have a Boolean variable that stores if it has been set or not.

“Invalid Objects” are references to nothing in memory, or references to objects that are pending kill. As Vectors aren’t stored by reference, and can’t “pend kill”, they can’t ever be invalid.

Thanks I see what you mean.