I have a cube positioned according to the average of multiple vector points. The problem is that some times I’ll have a point that is way too far and the cube will go off. Is there a possible way to make the values that are close to eachother have more influance than the extreme ones ?

There is something called Trimmed Mean to get the average while avoiding outliers. I don’t think Unity has a built in function for it. Here is a quick one I threw together:

```
// using System.Linq;
List<Vector3> TrimmedMean(List<Vector3> list, float percent = 0.01f)
{
int trim = Mathf.CeilToInt(percent * list.Count);
List<Vector3> trimmedList = list.OrderBy(x => x.sqrMagnitude).ToList();
trimmedList.RemoveRange(trimmedList.Count-trim, trim);
trimmedList.RemoveRange(0, trim);
return trimmedList;
}
```

It takes a list of vectors and a percent (0-1). It sorts the vectors by their sqrMagnitude and trims out the top and bottom by the percentage of vectors in the list. That gets rid of extreme values, but can also get rid of normal values at the ends too.