2018-05-27 09:05 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0003156FSSCPbeamspublic2015-04-17 09:00
ReporterMatthTheGeek 
Assigned Tom_m 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.7.2 RC4 
Target Version3.7.2Fixed in Version 
Summary0003156: Fighter beam range depends on target radius
DescriptionWhen +Range is defined in the $BeamInfo parameters of a fighter beam, the actual effective range of the beam ingame seems to vary based on the radius of the target.

In the test mod attached, a fighter beam with a +Range of 1000 is unable to hit an Orion 1.7km away, but can hit a Colossus 3.3km away.
TagsNo tags attached.
Attached Files
  • rar file icon fighterbeamtest.rar (3,850 bytes) 2015-04-06 13:44
  • patch file icon beam.cpp.patch (1,535 bytes) 2015-04-17 03:44 -
    Index: code/weapon/beam.cpp
    ===================================================================
    --- code/weapon/beam.cpp	(revision 11304)
    +++ code/weapon/beam.cpp	(working copy)
    @@ -2338,6 +2338,30 @@
     	int hull_enter_collision = model_collide(&mc_hull_enter);
     	int hull_exit_collision = (beam_will_tool_target(b, ship_objp)) ? model_collide(&mc_hull_exit) : 0;
     
    +    // If we have a range less than the "far" range, check if the ray actually hit within the range
    +    if (b->range < BEAM_FAR_LENGTH
    +        && (shield_collision || hull_enter_collision || hull_exit_collision))
    +    {
    +        // We can't use hit_dist as "1" is the distance between p0 and p1
    +        float rangeSq = b->range * b->range;
    +
    +        // actually make sure that the collision points are within range of our beam
    +        if (shield_collision && vm_vec_dist_squared(&b->last_start, &mc_shield.hit_point_world) > rangeSq)
    +        {
    +            shield_collision = 0;
    +        }
    +
    +        if (hull_enter_collision && vm_vec_dist_squared(&b->last_start, &mc_hull_enter.hit_point_world) > rangeSq)
    +        {
    +            hull_enter_collision = 0;
    +        }
    +
    +        if (hull_exit_collision && vm_vec_dist_squared(&mc_hull_exit.hit_point_world, &b->last_start) > rangeSq)
    +        {
    +            hull_exit_collision = 0;
    +        }
    +    }
    +
     	// check shields for impact
     	// (tooled ships are probably not going to be maintaining a shield over their exit hole,
     	// therefore we need only check the entrance, just as with conventional weapons)
    
    patch file icon beam.cpp.patch (1,535 bytes) 2015-04-17 03:44 +

-Relationships
+Relationships

-Notes

~0016600

m_m (developer)

The current collision code doesn't check if a detected collision is actually in range of the beam as the collision code will return every collision it can find.
I added a condition for beams where +Range is less than the far distance which checks the shield and hull collisions and invalidates them if the actual hit position is out of reach for the beam.

~0016644

m_m (developer)

Fix committed to trunk@11307.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2015-04-06 13:44 MatthTheGeek New Issue
2015-04-06 13:44 MatthTheGeek File Added: fighterbeamtest.rar
2015-04-06 15:53 m_m Note Added: 0016600
2015-04-06 15:53 m_m Assigned To => m_m
2015-04-06 15:53 m_m Status new => code review
2015-04-06 15:53 m_m File Added: beam.cpp.patch
2015-04-17 03:44 m_m File Deleted: beam.cpp.patch
2015-04-17 03:44 m_m File Added: beam.cpp.patch
2015-04-17 03:46 m_m Target Version => 3.7.2
2015-04-17 09:00 m_m Changeset attached => fs2open trunk r11307
2015-04-17 09:00 m_m Note Added: 0016644
2015-04-17 09:00 m_m Status code review => resolved
2015-04-17 09:00 m_m Resolution open => fixed
+Issue History