Well I managed to edit the code to get it to place the cube at the right position (see below). Problem is it only calculates everything once. So when I move and turn the player the cube stays at it's original position. I've tried to get it to update constantly, though it then manages to follow the player around it doesn't recalculate the offset and angle between the player and "objent".

How should I edit it this code to get it do do that?


Code:
	var attached;
	var offset_dist[3];
	var offset_angle[3];
  var attached = 0;
  
  	while(!player) { wait(1); }
		if(status_CarryBox)
    {
    	
      if(attached == 0)
      {
				offset_angle[0] = objent.pan;
				offset_angle[1] = 0;
				offset_angle[2] = 0;
				
				offset_dist.x = (player.x-objent.x);
				offset_dist.y = (player.y-objent.y);
				offset_dist.z = 0;
        attached = 1;
       
      }
my.pan = player.pan;
			
			vec_set(my.x,offset_dist.x);
			vec_diff(temp,player.pan,offset_angle);
			vec_rotate(my.x,temp);
			vec_add(my.x,player.x);
			


			
    }


Thanks!

cartoon_baboon

Last edited by cartoon_baboon; 03/09/09 08:19.