Determining damage from impacts?

Post Reply
Brian Beuken
Posts: 46
Joined: Sat Jul 29, 2017 9:19 pm

Determining damage from impacts?

Post by Brian Beuken »

Hi all,
sorry if this has been asked before, I had a look through the forum but can't find anything.

I have my 3D space game up and running pretty well, collisions for projectiles/rockets/ etc all going well. And I can comfortably detect when objects hit each other and allow them to bounce off while still registering the fact a collision occured and doing scraping sound effects .. But... I'd like to determine a way to decide hiowmuch damage an impact should to do both objects in a collission, especially if one of my ships is ramming the other?

Is there a simple way to get that from the collision response systems? There's a difference beween glancing blows which do little damage and contact and head on collision which could/should detroy one or both, but I can't think of an easy way to test?
User avatar
drleviathan
Posts: 849
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Determining damage from impacts?

Post by drleviathan »

I don't know of a simple way. I think some of the details of collisions, such as internal tension forces between bodies, are never even computed. Instead a collection of contact constraints that try to prevent rigid bodies from intepenetrating are iteratively "solved" using linear algebra and the results are: new positions and velocities. The intermediary forces involved are not known: they were whatever they had to be to maintain the constraints.

You will probably have to write custom logic to infer collision forces. For example: you could measure impulse (delta momentum) experienced by pairs of colliding objects and combine that with knowledge about the object relative sizes and mass to infer whether damage was done.
Brian Beuken
Posts: 46
Joined: Sat Jul 29, 2017 9:19 pm

Re: Determining damage from impacts?

Post by Brian Beuken »

yeah that makes sense.... was hoping there be some kind of internal impact value, but ok, I think I can work it out based on the velocity and inertia values...

I'll see how it goes...thanks
Post Reply