Skip to content

Commit b0166dd

Browse files
authored
fix null vector assertion in slash beam collisions (scp-fs2open#7038)
Beams in general, and slash beams most likely, can collide with the edge of a model, which will cause a non-normalized vector assertion when particle effects are created. So comment out the normal assignment until a more comprehensive fix can be coded.
1 parent a023a1a commit b0166dd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

code/weapon/beam.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3962,15 +3962,18 @@ 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-
particleSource->setNormal(worldNormal);
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);
39663968
particleSource->setTriggerRadius(width);
39673969
particleSource->finishCreation();
39683970
}
39693971

39703972
if(do_expl){
39713973
auto particleSource = particle::ParticleManager::get()->createSource(wi->impact_weapon_expl_effect);
39723974
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));
3973-
particleSource->setNormal(worldNormal);
3975+
// TODO: see comment above
3976+
// particleSource->setNormal(worldNormal);
39743977
particleSource->setTriggerRadius(width);
39753978
particleSource->finishCreation();
39763979
}
@@ -4026,7 +4029,8 @@ void beam_handle_collisions(beam *b)
40264029
auto particleSource = particle::ParticleManager::get()->createSource(wi->piercing_impact_effect);
40274030

40284031
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));
4029-
particleSource->setNormal(worldNormal);
4032+
// TODO: see comment above
4033+
// particleSource->setNormal(worldNormal);
40304034
particleSource->setTriggerRadius(width);
40314035
particleSource->finishCreation();
40324036
}

0 commit comments

Comments
 (0)