Hi guys,
I made an update with a new gimmick:

Code:
////////////////////////
// [B] seesaw v0.3 by Clemens (31.1.2011)
// Problems [help]: often the board just freezes (doesn't go back in the horizontal position) -> depends maybe on the pXent_setskinwidth value !??

function Pause_force_arrow(ENTITY* Arrow) {
	set(Arrow, TRANSLUCENT);
	wait(-0.4);
	reset(Arrow, TRANSLUCENT);
}
function create_seesaw() {
	pX_setautodisable (0, 0); // hoped that this would solve my freeze-problem -> does not! :(

	ENTITY* Seesaw_pillar = ent_create("seesaw_pillar.mdl", vector(0,-0.2,-93), NULL);	// Create the pillar of the seesaw 
	ENTITY* Seesaw_board = ent_create("seesaw_board.mdl", vector(0,0,-80), NULL);			// Create the board of the seesaw
	ENTITY* Force_arrow = ent_create("arrow3d.mdl", vector(0,0,-50), NULL);					// Create the force arrow, which shows where to give the force on the board
	// Just for the look
	color_me(Force_arrow, vector(0,0,255));
	color_me(Seesaw_pillar, vector(0,100,100));
	color_me(Seesaw_board, vector(200,0,0));

	pXent_settype(Seesaw_pillar,PH_STATIC,PH_CONVEX);
	//pXent_setmass(Seesaw_pillar, 1);		// this can be tried, when not making it static
	
	pXent_settype(Seesaw_board,PH_RIGID,PH_BOX);
 	pXcon_add (PH_HINGE, Seesaw_board, Seesaw_pillar, 0);
	pXcon_setparams1 (Seesaw_board, nullvector, vector(0,0,1), NULL);

	var Cylinder_handles[99];	// just don't create more than 99 rolling cylinders ;)
	var CylinderNo=0;	// [0] => at begin there are zero rolling cylinders
	gimmick_is_running=1;
	while(1) {
		//// (I) user control -> keyboard or(/plus) mouse supported
		Force_arrow.x += ( 5*(key_cur-key_cul) + 15*mouse_force.x )*time_step;	// moving the arrow
		// setting the arrow force
		Force_arrow.scale_z += ( 0.03*(key_cuu-key_cud) + mickey.z/70 )*time_step;
		if (Force_arrow.scale_z<0.5) Force_arrow.scale_z=0.5;	// minimum of size/force
		if (Force_arrow.scale_z>3) Force_arrow.scale_z=3;		// maximum of size/force
		// push the board with the force that has been set at the horizontal position of the arrow
		if (is(Force_arrow,TRANSLUCENT)==0) {
			if (key_space || mouse_left) {
				pXent_addforceglobal(Seesaw_board, vector(0, 0, -0.5*Force_arrow.scale_z), vector(Force_arrow.x, 0, 0));
				Pause_force_arrow(Force_arrow);
			}
			if (key_bksp || mouse_right) {
				pXent_addforceglobal(Seesaw_board, vector(0, 0, 0.5*Force_arrow.scale_z), vector(Force_arrow.x, 0, 0));
				Pause_force_arrow(Force_arrow);
			}			
		}		
		// create a rolling cylinder, which can be balanced on the seesaw
		if (key_shift || mouse_middle) {
			ENTITY* Rolling_cylinder = ent_create("wide_cylinder.mdl", vector(0,0,-50), NULL);
			color_me(Rolling_cylinder, vector(120,0,255));
			pXent_settype(Rolling_cylinder,PH_RIGID,PH_CONVEX);
			pXent_setmass(Rolling_cylinder,0.005);
			CylinderNo+=1;
			Cylinder_handles[CylinderNo] = handle(Rolling_cylinder);
			wait(-0.3);			// no nice elegant solution -> to [update]: externalize
		}
		//// (II) remove gimmick (without the cylinders)
		if (key_del) {
			ent_remove(Seesaw_board);
			ent_remove(Seesaw_pillar);	
			ent_remove(Force_arrow);
			break;
		}
		//pX_pick();	// to dangerous that it's used accidentally
		wait(1);
	}
	gimmick_is_running=0;
	(Info_text.pstring)[0]=Help_str;
	pX_setautodisable (2, 2);
	wait(-5);	// want the cylinders to stay some seconds...
	while (CylinderNo>0) {	// remove every created cylinders (step for step)
		ptr_remove(ptr_for_handle(Cylinder_handles[CylinderNo]));
		CylinderNo-=1;
		wait(-0.1);
	}
}





Collection a-b (whole package) Download

HeelX, happy to hear your interest. Looking forward for some gimmicks from you wink

And hopelly there will be some more persone here in the forum who like to play a little bit around with the physics engine and share the result here with us...



Edit on 8.9.2012: eaglelab asked me to reupload the package. Done!

Last edited by Clemens; 09/07/12 23:40.