///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysx.h>
///////////////////////////////
ENTITY* Kopf;
ENTITY* OberarmR;
ENTITY* UnterarmR;
ENTITY* HandR;
ENTITY* OberarmL;
ENTITY* UnterarmL;
ENTITY* HandL;
ENTITY* Bein1R;
ENTITY* Bein2R;
ENTITY* FussR;
ENTITY* Bein1L;
ENTITY* Bein2L;
ENTITY* FussL;
ENTITY* Body1;
ENTITY* Body2;
ENTITY* Body3;
ENTITY* Hals;
ENTITY* Skelett;
ENTITY* Plane;
function main()
{
vec_set(screen_size,vector(1200,900,0));
ENTITY* to;
var Motion[6];
video_window(NULL,NULL,0,"PhysX Grundsteuerung");
physX_open();
pX_setsteprate(512, 8, NX_TIMESTEP_VARIABLE);
pX_setccd (1);
level_load("");
Motion[0] = NX_D6JOINT_MOTION_LOCKED;
Motion[1] = NX_D6JOINT_MOTION_LOCKED;
Motion[2] = NX_D6JOINT_MOTION_LOCKED;
Motion[3] = NX_D6JOINT_MOTION_LOCKED;
Motion[4] = NX_D6JOINT_MOTION_FREE;
Motion[5] = NX_D6JOINT_MOTION_FREE;
wait(5);
Plane = ent_create(NULL, nullvector,NULL);
Kopf = ent_create("Kopf.mdl",nullvector,NULL);
OberarmR = ent_create("ArmR1.mdl",nullvector,NULL);
UnterarmR = ent_create("ArmR2.mdl",nullvector,NULL);
HandR = ent_create("HandR.mdl",nullvector,NULL);
OberarmL = ent_create("ArmL1.mdl",nullvector,NULL);
UnterarmL = ent_create("ArmL2.mdl",nullvector,NULL);
HandL = ent_create("HandL.mdl",nullvector,NULL);
Bein1R = ent_create("BeinR1.mdl",nullvector,NULL);
Bein2R = ent_create("BeinR2.mdl",nullvector,NULL);
FussR = ent_create("FusR.mdl",nullvector,NULL);
Bein1L = ent_create("BeinL1.mdl",nullvector,NULL);
Bein2L = ent_create("BeinL2.mdl",nullvector,NULL);
FussL = ent_create("FusL.mdl",nullvector,NULL);
Body1 = ent_create("Body1.mdl",nullvector,NULL);
Body2 = ent_create("Body2.mdl",nullvector,NULL);
Body3 = ent_create("Body3.mdl",nullvector,NULL);
Hals = ent_create("Hals.mdl",nullvector,NULL);
Skelett = ent_create("Skelett.mdl",vector(0,0,5000),NULL);
to = ent_create(NULL,nullvector,NULL);
vec_for_bone(Body1.x,Skelett,"Main");
vec_for_bone(Body2.x,Skelett,"Body");
vec_for_bone(Body3.x,Skelett,"Body1");
vec_for_bone(Hals.x,Skelett,"Body2");
vec_for_bone(Kopf.x,Skelett,"Head");
vec_for_bone(OberarmR.x,Skelett,"ArmR");
vec_for_bone(UnterarmR.x,Skelett,"ArmR1");
vec_for_bone(HandR.x,Skelett,"HandR");
vec_for_bone(OberarmL.x,Skelett,"ArmL");
vec_for_bone(UnterarmL.x,Skelett,"ArmL1");
vec_for_bone(HandL.x,Skelett,"HandL");
vec_for_bone(Bein1R.x,Skelett,"LegR");
vec_for_bone(Bein2R.x,Skelett,"LegR1");
vec_for_bone(FussR.x,Skelett,"FootR");
vec_for_bone(Bein1L.x,Skelett,"LegL");
vec_for_bone(Bein2L.x,Skelett,"LegL1");
vec_for_bone(FussL.x,Skelett,"FootL");
pXent_settype(Plane, PH_STATIC, PH_PLANE);
pXent_settype(Kopf, PH_RIGID, PH_CONVEX);
pXent_settype(OberarmR, PH_RIGID, PH_CONVEX);
pXent_settype(UnterarmR, PH_RIGID, PH_CONVEX);
pXent_settype(HandR, PH_RIGID, PH_CONVEX);
pXent_settype(OberarmL, PH_RIGID, PH_CONVEX);
pXent_settype(UnterarmL, PH_RIGID, PH_CONVEX);
pXent_settype(HandL, PH_RIGID, PH_CONVEX);
pXent_settype(Bein1R, PH_RIGID, PH_CONVEX);
pXent_settype(Bein2R, PH_RIGID, PH_CONVEX);
pXent_settype(FussR, PH_RIGID, PH_CONVEX);
pXent_settype(Bein1L, PH_RIGID, PH_CONVEX);
pXent_settype(Bein2L, PH_RIGID, PH_CONVEX);
pXent_settype(FussL, PH_RIGID, PH_CONVEX);
pXent_settype(Body1, PH_RIGID, PH_CONVEX);
pXent_settype(Body2, PH_RIGID, PH_CONVEX);
pXent_settype(Body3, PH_RIGID, PH_CONVEX);
pXent_settype(Hals, PH_RIGID, PH_CONVEX);
pXent_setelasticity(Plane, 0);
pXent_setelasticity(Kopf, 0);
pXent_setelasticity(Hals, 0);
pXent_setelasticity(Body1, 0);
pXent_setelasticity(Body2, 0);
pXent_setelasticity(Body3, 0);
pXent_setelasticity(OberarmR, 0);
pXent_setelasticity(UnterarmR, 0);
pXent_setelasticity(HandR, 0);
pXent_setelasticity(Bein1R, 0);
pXent_setelasticity(Bein2R, 0);
pXent_setelasticity(FussR, 0);
pXent_setelasticity(OberarmL, 0);
pXent_setelasticity(UnterarmL, 0);
pXent_setelasticity(HandL, 0);
pXent_setelasticity(Bein1L, 0);
pXent_setelasticity(Bein2L, 0);
pXent_setelasticity(FussL, 0);
pXcon_add(PH_6DJOINT,Body1,Body2,0);
vec_for_bone(to.x,Skelett,"Body");
pXcon_setparams1(Body1, to.x,NULL,NULL);
pXcon_set6djoint(Body1,Motion,NULL);
pXcon_add(PH_6DJOINT,Body2,Body3,0);
vec_for_bone(to.x,Skelett,"Body1");
pXcon_setparams1(Body2, to.x,NULL,NULL);
pXcon_set6djoint(Body2,Motion,NULL);
pXcon_add(PH_6DJOINT,Body3,Hals,0);
vec_for_bone(to.x,Skelett,"Body2");
pXcon_setparams1(Body3, to.x,NULL,NULL);
pXcon_set6djoint(Body3,Motion,NULL);
pXcon_add(PH_6DJOINT,OberarmR,Body3,0);
vec_for_bone(to.x,Skelett,"ArmR");
pXcon_setparams1(OberarmR, to.x,NULL,NULL);
pXcon_set6djoint(OberarmR,Motion,NULL);
pXcon_add(PH_6DJOINT,OberarmL,Body3,0);
vec_for_bone(to.x,Skelett,"ArmL");
pXcon_setparams1(OberarmL, to.x,NULL,NULL);
pXcon_set6djoint(OberarmL,Motion,NULL);
pXcon_add(PH_6DJOINT,Hals,Kopf,0);
vec_for_bone(to.x,Skelett,"Head");
pXcon_setparams1(Hals, to.x,NULL,NULL);
pXcon_set6djoint(Hals,Motion,NULL);
pXcon_add(PH_6DJOINT,UnterarmR,OberarmR,0);
vec_for_bone(to.x,Skelett,"ArmR1");
pXcon_setparams1(UnterarmR, to.x,NULL,NULL);
pXcon_set6djoint(UnterarmR,Motion,NULL);
pXcon_add(PH_6DJOINT,UnterarmL,OberarmL,0);
vec_for_bone(to.x,Skelett,"ArmL1");
pXcon_setparams1(UnterarmL, to.x,NULL,NULL);
pXcon_set6djoint(UnterarmL,Motion,NULL);
pXcon_add(PH_6DJOINT,HandR,UnterarmR,0);
vec_for_bone(to.x,Skelett,"HandR");
pXcon_setparams1(HandR, to.x,NULL,NULL);
pXcon_set6djoint(HandR,Motion,NULL);
pXcon_add(PH_6DJOINT,HandL,UnterarmL,0);
vec_for_bone(to.x,Skelett,"HandL");
pXcon_setparams1(HandL, to.x,NULL,NULL);
pXcon_set6djoint(HandL,Motion,NULL);
pXcon_add(PH_6DJOINT,Bein1R,Body1,0);
vec_for_bone(to.x,Skelett,"LegR");
pXcon_setparams1(Bein1R, to.x,NULL,NULL);
pXcon_set6djoint(Bein1R,Motion,NULL);
pXcon_add(PH_6DJOINT,Bein1L,Body1,0);
vec_for_bone(to.x,Skelett,"LegL");
pXcon_setparams1(Bein1L, to.x,NULL,NULL);
pXcon_set6djoint(Bein1L,Motion,NULL);
pXcon_add(PH_6DJOINT,Bein2R,Bein1R,0);
vec_for_bone(to.x,Skelett,"LegR1");
pXcon_setparams1(Bein2R, to.x,NULL,NULL);
pXcon_set6djoint(Bein2R,Motion,NULL);
pXcon_add(PH_6DJOINT,Bein2L,Bein1L,0);
vec_for_bone(to.x,Skelett,"LegL1");
pXcon_setparams1(Bein2L, to.x,NULL,NULL);
pXcon_set6djoint(Bein2L,Motion,NULL);
pXcon_add(PH_6DJOINT,FussR,Bein2R,0);
vec_for_bone(to.x,Skelett,"FootR");
pXcon_setparams1(FussR, to.x,NULL,NULL);
pXcon_set6djoint(FussR,Motion,NULL);
pXcon_add(PH_6DJOINT,FussL,Bein2L,0);
vec_for_bone(to.x,Skelett,"FootL");
pXcon_setparams1(FussL, to.x,NULL,NULL);
pXcon_set6djoint(FussL,Motion,NULL);
pXent_setiterations(Kopf, 128);
pXent_setiterations(Hals, 128);
pXent_setiterations(Body1, 128);
pXent_setiterations(Body2, 128);
pXent_setiterations(Body3, 128);
pXent_setiterations(OberarmR, 128);
pXent_setiterations(UnterarmR, 128);
pXent_setiterations(HandR, 128);
pXent_setiterations(Bein1R, 128);
pXent_setiterations(Bein2R, 128);
pXent_setiterations(FussR, 128);
pXent_setiterations(OberarmL, 128);
pXent_setiterations(UnterarmL, 128);
pXent_setiterations(HandL, 128);
pXent_setiterations(Bein1L, 128);
pXent_setiterations(Bein2L, 128);
pXent_setiterations(FussL, 128);
vec_set(camera.x,vector(1000,0,0));
vec_set(camera.pan,vector(180,15,0));
while(1)
{
pX_pick();
wait(1);
}
}