We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 637a962 + 941b729 commit b1b197cCopy full SHA for b1b197c
code/asteroid/asteroid.cpp
@@ -1568,8 +1568,12 @@ void asteroid_maybe_break_up(object *pasteroid_obj)
1568
vec3d tempv = dir_vec;
1569
vm_vec_random_cone(&dir_vec, &tempv, (360.0f / total_roids / 2));
1570
1571
- // Make the roid inherit half of the parent's velocity
1572
- vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
+ // Make the roid inherit half of parent's directional movement
+ if (!IS_VEC_NULL(&pasteroid_obj->phys_info.vel)) {
1573
+ vm_vec_copy_normalize(&parent_vel, &pasteroid_obj->phys_info.vel);
1574
+ } else {
1575
+ vm_vec_rand_vec_quick(&parent_vel);
1576
+ }
1577
vm_vec_scale(&parent_vel, 0.5f);
1578
1579
// Make the hit position affect the direction, but only a little
0 commit comments