setComponent method
-
index - 0, 1 or 2.
-
value - Float
-
If index equals 0 set x to value.
-
If index equals 1 set y to value.
-
If index equals 2 set z to value
Implementation
Vector3 setComponent(int index, double value) {
switch (index) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw ('index is out of range: $index');
}
return this;
}