Handmade Hero»Forums»Code
jeringa
19 posts
"Room" Collision detecter
Edited by jeringa on
When running two loops, One for the room and another for any sold object collisions
you mentioned that you would take the min of t(in) and t(out)

t(out) -> 1
t(in) -> 0

If you ran the t(in) check first then the second loop would run t(out) = 0 -> t(in)
wouldn't that be quicker? Or is that a premature optimisation?
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
"Room" Collision detecter
Well, the problem is that I'm not sure we could actually leverage that knowledge. In order to compare the t's, we have to find the t's, which is the hard part :( But it is true that if we had good ways to early-out on t values, then we could definitely save work by doing it the way your suggest, since it would potentially put the maximum t value for the start of the second loop closer to the start point.

It is definitely a good thought, though, regardless!

- Casey