Is it possible to get an average X,Y coordinate from a group of objects?
Say I've used the selection box to select those blue boxes, I'm not sure how I'd get the coordinates of that red thing.
+ For each object
+ Object is in selected area
-> add .x to global('avX')
-> add .y to global('avY')
-> add 1 to global('numSelected')
-> Set redcrossthing.x to (avX / numSelected)
-> Set redcrossthing.y to (avY / numSelected)
whoa, thats a great simple idea. thanks!
Develop games in your browser. Powerful, performant & highly capable.
If I'm not mistaken
Should get the average, or half the distance between all.
Cubic is not an average, it's an interpolator.
Deadeye's code would do the trick