Dividing the Collider Offset Lerp by 2 Reason

This could be completely wrong, but I think the reason we divide the collider offset amount by 2 in the Coroutine is because when we increase the collider size by 1 unit, it increases on both sides by 0.5. When we increase the collider offset by 1 unit, it moves the entire collider 1 unit. This way, the offset moves twice as much in one direction than the collider, so we have to divide it by 2.

Again, this could be completely wrong, but the reasoning at least my sense in my head. I would be happy to hear if this is correct or not, as it’s not really addressed in the video.

2 Likes

Your reasoning is correct! When you increase the size of a collider, it grows symmetrically around its center. So if you increase the size by 1 unit, it will expand by 0.5 units on either side of the center. However, when you change the offset of a collider, you are moving the entire collider in one direction. So a change of 1 unit in the offset will move the center of the collider by 1 unit.

1 Like

Thank you kindly for the confirmation. I’m glad to have figured something out :smiley:

1 Like

Yeah it’s always nice to figure something out on your own, great job doing so!

1 Like

Privacy & Terms