Source Code Project Mantis - FSSCP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0002664 | FSSCP | math-related | public | 2012-06-09 23:53 | 2012-11-23 21:14 |
|
Reporter | niffiwan | |
---|
Assigned To | niffiwan | |
---|
Priority | normal | Severity | major | Reproducibility | always |
---|
Status | resolved | Resolution | fixed | |
---|
Platform | | OS | | OS Version | |
---|
Product Version | 3.6.14 RC6 | |
---|
Target Version | 3.6.16 | Fixed in Version | 3.6.15 | |
---|
|
Summary | 0002664: shockwaves uses target objects radius to calculate damage |
---|
Description | When calculating the distance at which shockwaves will do damage to a given target, the target of the shockwave is treated as being a sphere. For any model with a shape that is not perfect sphere, this method will have inaccuracies. It's particularly noticeable with the Karuna from Blueplanet2 as the one of the Karunas primary weapons is the Apocalyse missile (which has a shockwave), and the Karuna model is long and thin. Any target of the Karuna that is close and not directly fore/aft of the ship will cause the Karuna to take damage from it's own weapons, even though "logically" the ship is outside the shockwave outer radius. |
---|
Steps To Reproduce | Some discussion has occurred in this forum post.
http://www.hard-light.net/forums/index.php?topic=80146.msg1615180#msg1615180
I've attached a mission from qwadtep which showcases the issue. In theory none of the Karunas should take damage from their own missiles, however either 2 or 3 do, depending on which Karuna model is in use. |
---|
Additional Information | The obvious solution is to be to be more accurate with the distance calculation. My concern is how this will affect performance, as I believe that collision detection is the current bottleneck in FSO.
One idea would be to calculate a cylinder for shockwave distance calculations - which is still an approximation but could be accurate enough for most cases. I think this would require two more pieces of information, radius & world position we have, we'd need length and orientation of the cylinder. I think I came across a existing function somewhere which will calculate the closest point on a cylinder to a given world position? (of course I can't find said function now...)
Another idea would be to use something similar to the weapon impact calculations, i.e. use the lod0 model with all its polygons. Obviously this gives the most accurate results, but is it too computationally expensive? |
---|
Tags | No tags attached. |
---|
Relationships | |
Attached Files | test-range.fs2 (14,882) 2012-06-09 23:53 http://scp.indiegames.us/mantis/file_download.php?file_id=1864&type=bug
mantis_2664.patch (6,003) 2012-11-19 04:11 http://scp.indiegames.us/mantis/file_download.php?file_id=1975&type=bug
mantis_2664_puresvn.patch (5,481) 2012-11-23 04:11 http://scp.indiegames.us/mantis/file_download.php?file_id=1990&type=bug |
---|
Notes |
|
(0013652)
|
The_E
|
2012-06-10 17:18
|
|
Why not use the rotated model bounding box?Seems to me that that would be a good first place to start, instead of going straight to full-on ray collisions with LOD0. |
|
|
|
The bounding box sounds like a good idea, I'm ashamed to admit it but I didn't know they existed when I logged the ticket :-) Since then I've been doing some wiki reading about the .pof format. Just to further expose my knowledge deficiencies in this area - what's the "rotated" model bbox? I presume that the "normal" bbox is described in the OBJ chunks, by these three values?
vector geometric_center
vector bounding_box_min_point
vector bounding_box_max_point
http://www.hard-light.net/wiki/index.php/POF_data_structure |
|
|
(0013660)
|
The_E
|
2012-06-11 05:08
|
|
Rotated just means that you have to rotate the bbox coords into world coordinates by using vec_rotate with the objects current orientation matrix. |
|
|
|
I found a function in the aicode for getting the nearest point on a bounding box so I moved that around and reused it for the shockwaves check. My testing with the attached mission now has only the 400m Karuna taking some self damage, and only some of the time, probably from missile impacts on the nearest engine section of the Deimos.
Could someone please review the patch and provide comments? Thanks |
|
|
|
The patch looks okay, but I want to look at it in context with the code, and unfortunately the patch can no longer be cleanly applied. Can you make a new patch against latest trunk? |
|
|
|
Oops - old patch was in git format, not svn format. Does this one apply cleanly? You might need the tortoise equivalent of "patch -p1" to ignore the leading fs2_open directory in the patch paths. |
|
|
|
Unfortunately no. Is it diff'd against current trunk? |
|
|
|
Gah! It was created vs the current trunk on the day it was attached. I've had a problem like this before, I'll redo the patch again not using git at all this time... |
|
|
|
OK - try mantis_2664_puresvn.patch :) |
|
|
|
Looks good. :yes: Both the math and the logic. I say go ahead and commit it. |
|
|
|
Thanks - committed in r9371 |
|