Can you divide vectors in Haxe like this?

Say I have two vectors, v and v2. I see elsewhere that I can multiply them together in Haxe like so:

v.x *= v2.x;
v.y *= v2.y;
v.z *= v2.z;

But can you similarly divide one vector by another like this?

v.x /= v2.x;
v.y /= v2.y;
v.z /= v2.z;

That depends on whether the vector implementation implements the operator. Haxe’s operator overloading does support both in principle.

Armory’s vector classes don’t have the operator overloading so that you can use the *= or /= operators on them. It looks like there isn’t a divide function in Armory’s Vector class either.

Mr Blob multiplies element by element so this doesn’t require operator overloading and consequently the answer is: Yes.

Ah, should’ve paid more attention to the code example than the question. He isn’t actually dividing vectors there. :slight_smile:

1 Like

:man_facepalming: Yep, that’s right. :smile: