Comment

Comment by Tade0

Back in college I had this course during which we were supposed to design an object-oriented app in Java using concurrency and networking - games were the usual use case.

Our professor asked us how would we implement hit detection - there were a few answers, but none touched the underlying idea that when there's no agent(user, AI) input, objects move in a predictable way, so the distance between them is some function of time.

For example the distance function of two objects moving in a linear fashion is (IIRC) a squared parabola, so you only need to sample three points in time to get the whole function.

And, of course, you only need to recalculate this function for objects that changed direction.

parent Tade0 6 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton