Tim2othy / spacegame

2 stars 1 forks source link

Better Asteroid Bouncing #9

Open lumi-a opened 3 weeks ago

lumi-a commented 3 weeks ago

In the Disk.bounce_off_of_disk-method, the impulse of the disk-that's-bounced-off-of is not respected.

Also, I'm not sure what value in the calculations corresponds to the severity of impact that self suffered. Currently, j (the "impulse scalar" (?)) is returned, but that seems quite high. If changed, the damage-calculation for the ship should probably drop its sqrt, as well.

Lastly, the Disk.bounce_off_of_disk more-or-less assumes that no energy is lost (despite causing ship-damage). It used to be the case that the ship was only deflected with about half its original velocity. Is that still desired?

lumi-a commented 3 weeks ago

Oh, and I have no idea what the physical interpretation of the if self_vel_along_normal > 0: check is. Is it correct behaviour that the function terminates early in that case, and that it reports that no impact occurred?

lumi-a commented 3 weeks ago

Also, in Universe.apply_bounce(), the asteroids try to bounce off of each other. However, the current implementation of Disk.bounce_off_of_disk() only allows a one-sided interaction: It bounces Asteroid A off of Asteroid B, but leaves B unaffected. Because A is then moved outside of B, B never gets a chance at bouncing off of A.

This should probably be dealt with by introducing a second bounce-method that has both objects bounce off of each other. The current method must persist, because e.g. a ship bounces off of a planet, but a planet doesn't bounce off of a ship.

Tim2othy commented 3 weeks ago

the way the ship stuff bounces against the planets seems fine for now. So creating a new asteroid bounce method seems like the thing to do.