Skip to content

Commit 7875e5f

Browse files
authored
Supply normals for edge hits (#7039)
* Pass out normals for edge hits * Remove now-obsolete comments * Also add third instance of disabled particle normal
1 parent 8057b52 commit 7875e5f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

code/model/modelcollide.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ static void mc_check_sphereline_face( int nv, vec3d ** verts, vec3d * plane_pnt,
323323
// This is closer than best so far
324324
Mc->hit_dist = sphere_time;
325325
Mc->hit_point = hit_point;
326+
Mc->hit_normal = *plane_norm;
326327
Mc->hit_submodel = Mc_submodel;
327328
Mc->edge_hit = true;
328329

code/weapon/beam.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3962,18 +3962,15 @@ void beam_handle_collisions(beam *b)
39623962
if (wi->flash_impact_weapon_expl_effect.isValid()) {
39633963
auto particleSource = particle::ParticleManager::get()->createSource(wi->flash_impact_weapon_expl_effect);
39643964
particleSource->setHost(beam_hit_make_effect_host(b, &Objects[target], b->f_collisions[idx].cinfo.hit_submodel, &b->f_collisions[idx].cinfo.hit_point_world, &b->f_collisions[idx].cinfo.hit_point));
3965-
// TODO: Commenting out until the collision code can be enhanced to return a valid normal when a beam collides with an edge.
3966-
// (This can happen when a slash beam moves off the edge of a model; edge_hit will be true and hit_normal will be 0,0,0.)
3967-
// particleSource->setNormal(worldNormal);
3965+
particleSource->setNormal(worldNormal);
39683966
particleSource->setTriggerRadius(width);
39693967
particleSource->finishCreation();
39703968
}
39713969

39723970
if(do_expl){
39733971
auto particleSource = particle::ParticleManager::get()->createSource(wi->impact_weapon_expl_effect);
39743972
particleSource->setHost(beam_hit_make_effect_host(b, &Objects[target], b->f_collisions[idx].cinfo.hit_submodel, &b->f_collisions[idx].cinfo.hit_point_world, &b->f_collisions[idx].cinfo.hit_point));
3975-
// TODO: see comment above
3976-
// particleSource->setNormal(worldNormal);
3973+
particleSource->setNormal(worldNormal);
39773974
particleSource->setTriggerRadius(width);
39783975
particleSource->finishCreation();
39793976
}
@@ -4029,8 +4026,7 @@ void beam_handle_collisions(beam *b)
40294026
auto particleSource = particle::ParticleManager::get()->createSource(wi->piercing_impact_effect);
40304027

40314028
particleSource->setHost(beam_hit_make_effect_host(b, &Objects[target], b->f_collisions[idx].cinfo.hit_submodel, &b->f_collisions[idx].cinfo.hit_point_world, &b->f_collisions[idx].cinfo.hit_point));
4032-
// TODO: see comment above
4033-
// particleSource->setNormal(worldNormal);
4029+
particleSource->setNormal(worldNormal);
40344030
particleSource->setTriggerRadius(width);
40354031
particleSource->finishCreation();
40364032
}

0 commit comments

Comments
 (0)