Talk:3d Math functions

The current script actually fails to compile. I believe the last function is wrong?

void VectorsToTransform(ref GameObject gameObjectInOut, Vector3 positionVector, Vector3 directionVector, Vector3 normalVector)

should really be

public static void VectorsToTransform(ref GameObject gameObjectInOut, Vector3 positionVector, Vector3 directionVector, Vector3 normalVector)

and it should be inside of the Math3D class.

Also there is no reason for this class to extend from MonoBehavior. The class should extend from nothing given it's nature.

Then the Init function should be changed to this to fix the resulting compile errors

I would post these changes myself but. I figure I should let the original author do this in case I am assuming something too far and am actually wrong.

small perfomance improvement
this is a pretty minor performance enhancement if it's only being called a couple times per frame, but if it were called on 1000s of vectors per frame it could add up.

original version:

optimized - remove a call to Normalize, remove a Vector3 new.