Dividing vectors

I read the documentation about vectors and found out that I have to use methods for math operations, but somehow I can’t find a method for dividing vectors.
When I use like in c++ or C# (Unity) overloaded operator, in PlayCanvas it gives me NaN result.

Is there any method for this?

Normally, I do:

vec.scale(1 / divisor);

java script unfortunately does not have operator overloading, so you need to call functions.

var a = new pc.Vec3(10, 10, 10);
var b = new pc.Vec3(20, 20, 20);

Just thinking about it, while scale may be how most people divide vectors, that might not be obvious to many people (as @Dava illustrates). Perhaps we should add Vec3#div to the API.


@mvaligursky I am using “add” ,“sub” ,“mul” , but like I said div is missing
I can use scale or “by hand”, but I think new users would be confused by this

Fair point, I create an issue https://github.com/playcanvas/engine/issues/2942