I've been trying to figure this out but the solution is not forthcoming. My ball keeps disappearing to it's original location whenever I break the movement loop. It's supposed to still be at the player's feet when I call the pass() of shot() functions but instead, it returns to it's original position first. In fact, while moving, I am unable to move if I am at the original location because collision detection with the ball is taking place. I have to turn to move to other locations with the ball.

Please is there a way I can update the real ball position to the current x, y and z locations or how can I implement it in the current while loop. Any help or advice is greatly appreciated.

Here are the codes:

Code:
action theBall()
{
	while(!player) wait(1);
	
   set(my, SHADOW);
	
	phent_settype(my, PH_RIGID, PH_SPHERE);
	phent_setmass(my, 1, PH_SPHERE);
	phent_setfriction(my,90);
	phent_setelasticity(my,75,100);
	phent_setdamping(my,30,5);
	phent_addvelcentral(my,vector(10,10,0));
	ph_setgravity(vector(0,0,-500));
   

	//dcam();
	my.emask |= ENABLE_FRICTION;
	
	
	while(1){	
	
     if((key_w || key_a || key_s || key_d) && vec_dist(my.x, player.x) <= 20){
        move_with_ball();
     }	 
      wait(1);
   }
}



The ball movement:

Code:
function move_with_ball()
{

while(my == NULL) wait(1);


while(1){
		proc_mode = PROC_LATE;

      vec_set(my.x,vector(player.x + 13 * cos(player.pan),player.y + 13 * sin(player.pan), player.z - 12));
      my.roll+=20;
      my.tilt+=20;
      
      if(key_x){
      	pass();
      	break;
      }
      
      if(key_space){
      	shot();
      	break;
      }
      
      if(key_1){
      break;	
      }	
       
      
wait(1);
}
}




I know I can.