I notice that most of the mathematical operations for the basic 3D data structures (Vectors, Matrixes, Quaternions, etc.) have three versions: the basic one, the “…inPlace” version, and a “…toRef” method. I suspect that I’m not fully taking advantage of the latter.
As an example, a Vector3 can be added–myVect.add(myOtherVect)–added in place–myVect.addInPlace(myOtherVect)–or added “to ref”–myVect.addToRef(myOtherVect). The first creates a new Vector3 object as its result. The second changes the original Vector3 object to its sum with the other, but then there’s a third option. What does it do? When is it most beneficial to use?