Okay, let's call it a ball launcher then. That is a better word. Thanks for that tip, though I'm still having trouble with my ball launcher. It behaves very strangely indeed:

Code:


//Ball launcher

constaint1[3]=1,0,0; //only allows movement on x axis?

function create_ball_launcher()
{
temp.x=ball_pos.x+400; //put in position relativeto where ball is created
temp.y=ball_pos.y;
temp.z=ball_pos.z-130;

ent_create("ball_launcher.wmb", temp, init_ball_launcher);
}

function init_ball_launcher()
{


phent_settype(my, ph_rigid, ph_box);
phcon_add(ph_slider, my, 0);

phcon_setparams1(constraint1, vector(1,0,0),nullvector,nullvector); // I thought that the second agument of this set the contraint axis?
phcon_setparams2(constraint1, vector(-50,0,0),nullvector,nullvector);

while(my!=null)
{

temp.x=-spring + random(200)-100;
temp.y=1600000;
temp.z=0;
//punch ball out shoot
phcon_setmotor(constraint1, temp, nullvector, nullvector);
sleep(0.5);
temp.x-=temp.x;
phcon_setmotor(constraint1, temp, nullvector, nullvector);
sleep(0.5);
}
}




The entity bobs around and spins.

Also, is there a way to stop the entity from spinning?

Last edited by A.Russell; 06/06/04 22:01.