add2 method

Vector4 add2(
  1. Vector a,
  2. Vector b
)

Implementation

Vector4 add2(Vector a, Vector b) {
  x = a.x + b.x;
  y = a.y + b.y;
  if(a is Vector4 && b is Vector4){
    z = a.z + b.z;
    w = a.w + b.w;
  }
  else if(a is Vector3 && b is Vector3){
    z = a.z + b.z;
  }
  else if(a is Vector4 && b is Vector3){
    z = a.z + b.z;
  }
  else if(a is Vector3 && b is Vector4){
    z = a.z + b.z;
  }
  return this;
}