I have a test case with two balls, moving along X-axis in opposite directions until they collide. My intention is that both of them disappear in collision. However, most of the time only one ball disappears and other proceeds further along x axis. Here is the code:

Code:

#include <acknex.h>
#include <default.c>

ENTITY* ball1;
ENTITY* ball2;


function collision_impact()
{
	ent_remove(my);
}

action ball_move()
{
	my.emask |= ENABLE_IMPACT;
	my.event = collision_impact;
	while (!key_ctrl) wait (1); // wait until the player presses the [ctrl] key
	while (my != NULL)
	{
		c_move(my, vector(50 * time_step, 0, 0), nullvector, GLIDE);
		wait (1);
	}
}

function main()
{
	video_mode = 9;
		
	level_load ("");
	vec_set(camera.x,vector(0, -1000, 0));
	vec_set(camera.pan,vector(90, 0, 0));
		
	ball1 = ent_create ("ball.mdl", vector(-500, 0, 0), ball_move);
	ball2 = ent_create ("ball.mdl", vector(500, 0, 0), ball_move);
	ball2.pan = 180;
}



I don't know why this is not working, where did I make mistake?