View Single Post
Old 06 January 2013, 22:38   #48
Mrs Beanbag
Glastonbridge Software
Mrs Beanbag's Avatar
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,202
I'm not saying it isn't possible on the Amiga. What I'm saying is it isn't as trivial as you suggest.

Gravity, yes, that's easy. It's simply a downward acceleration. But it's not just gravity. It's also a lot of objects bouncing off each other and spinning round. Collision detection between a large number of objects is tricky enough in itself. It's possible in O(n log n) time using interval trees. It isn't possible in linear time (i.e. it's not just a case of looping through each object because there are multiple dependencies to take into account, when any one of those n objects can collide with any other of them). And then when you go to actually calculate the collisions...

Given that you can narrow the problem down to a collision between two objects. Suppose they are round objects. Both of them are moving. You have to calculate the position of both at the point at which they hit each other. Then you have to do some more vector arithmetic to calculate their new directions, after the collision.

For round objects that's actually quite easy, in theory. It involves a small bit of CPU bashing, involving multiplications. But if you want to calculate collisions between a round object and a rectangular object, that's a little trickier. If that rectangular object can be rotated at any angle, that's even tricker still.

Now, suppose we need to calculate the interactions of TWO rectangular objects, that are rotated at arbitrary angles, and also SPINNING at the same time. I'm going to write this in capital letters. THIS IS NOT A SIMPLE PROBLEM.

Read this and then tell me it is a simple problem:
And this just returns whether or not two rotated rectangles overlap - true or false - we've then got to go on to work out in exactly what way they push each other about.
Mrs Beanbag is offline  
Page generated in 0.03846 seconds with 10 queries