Challenge 2: Centroid Measurement

Our measurements are not exactly perfect. The X and Y position of a game object is set to its top left corner. This means you might see some issues when comparing different sides of different-sized objects.

It's more accurate to measure from the center of each object. But where is that?

Good news: we have width, height and anchorPoint blocks. Width and height are fairly self-explanatory.

Anchorpoints are a special type of data. They specify a point offset from the X, Y position of an object. The object rotates and scales around that point, rather than its corner. This is why the monkeys rotate sensibly when aiming.

Better news: the anchorpoints are already set up for monkeys and bloons.

Your challenge is to use the anchorpoints to measure distances from the center of objects, rather than the top left corner. Over to you!

Mastering this challenge indicates excellent understanding of pivot points.

Challenge Exercise: Demonstrate Imperfection

Draw a diagram showing why our measurements are not perfect. Use two boxes of different sizes, without rotating them, with one side touching. Measure the distance between the top left corners. Then rearrange the boxes so that the corners are a different distance apart, even though the boxes are still touching.

results matching ""

    No results matching ""