I am playing around with the physics engine for the first time and having a problem. I am trying to create a pendulum that swings only on 1 axis.

The problem I am having is altough I am using a hinge constraint I can add velocity from 2 directions.

Any comments on what is wrong with my code would be great.

Code:
 
ENTITY* box1;
ENTITY* box2;

function setBoxPhysics(ENTITY* box, var mass)
{
	phent_settype(box, PH_RIGID, PH_BOX);
	phent_setmass(box,mass,PH_BOX);
	phent_setfriction(box,20);
	phent_setelasticity(box,30,100);
	phent_setdamping(box,30,5);
}

function y_force()
{
	phent_addvelcentral(box1, vector(0,500,0));
}

function x_force()
{
	phent_addvelcentral(box1, vector(500,0,0));
}

function main()
{
	level_load("mine.wmb");
	
	wait(1);
	ph_setgravity(vector(0,0,-500));
	
	box1 = ent_create("cube.wmb", vector(600,176,-408), NULL);
	setBoxPhysics(box1, 100);
	
	box2 = ent_create("cube.wmb", vector(600,176,-208), NULL);
	setBoxPhysics(box2, 0);
	
	
	var hingeID;
	
	hingeID = phcon_add(PH_HINGE, box1, box2);
	phcon_setparams1(hingeID, box2.x, vector(1,0,0), NULL);
	phcon_setparams2(hingeID, vector(-45,45,0), nullvector, nullvector);
	
	
	on_x = x_force;
	on_y = y_force;
	
	while(1)
	{
		wait(1);
	}	
}