action spin_wheel1()
{
//ENTITY* mechanik2 = ent_create ("kreuz.mdl", vector(me.x+120,0,10), my_wheel1);
ENTITY* gear1 = ent_create("add_shape2.mdl",vector(me.x+120,0,0),NULL);
set(gear1, VISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
gear1.pan = i;
pXent_addshape(me, gear1, PH_BOX);
}
pXent_removeshape(my, 0);
//
var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE};
pXcon_add(PH_6DJOINT,me,NULL,0);
pXcon_set6djoint(me,Motion,NULL);
}
action spin_wheel2()
{
// ENTITY* mechanik2 = ent_create ("kreuz.mdl", vector(me.x-120,0,10), my_wheel1);
ENTITY* gear2 = ent_create("add_shape2.mdl",vector(me.x-120,0,0),NULL);
set(gear2, VISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
gear2.pan = i;
pXent_addshape(me, gear2, PH_BOX);
}
pXent_removeshape(my, 0);
//
var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE};
pXcon_add(PH_6DJOINT,me,NULL,0);
pXcon_set6djoint(me,Motion,NULL);
}
action spin_wheel3()
{
// ENTITY* mechanik2 = ent_create ("kreuz.mdl", vector(me.x+120,0,10), my_wheel1);
ENTITY* gear3 = ent_create("add_shape2.mdl",vector(0,me.y+120,0),NULL);
set(gear3, VISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
gear3.pan = i;
pXent_addshape(me, gear3, PH_BOX);
}
pXent_removeshape(my, 0);
//
var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE};
pXcon_add(PH_6DJOINT,me,NULL,0);
pXcon_set6djoint(me,Motion,NULL);
}
action spin_wheel4()
{
// ENTITY* mechanik2o = ent_create ("add_shape2.mdl", vector(me.x+120,0,10), my_wheel1);
ENTITY* gear4 = ent_create("add_shape2.mdl",vector(0,me.y-120,0),NULL);
set(gear4, VISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
gear4.pan = i;
pXent_addshape(me, gear4, PH_BOX);
}
pXent_removeshape(my, 0);
//
var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE};
pXcon_add(PH_6DJOINT,me,NULL,0);
pXcon_set6djoint(me,Motion,NULL);
///////////////////////////////////////
// pXent_setbodyflag(me,NX_BF_KINEMATIC,1);
/// while (1)
//{
// angle.pan += -1*time_step;
// pXent_rotate(me, nullvector, vector(angle.pan,0,0));
// wait(1);
// }
//
}
///////////////////////////////////////////////////////
action mechanik_5()
{
while (1)
{
my.pan += 1;
wait(1);
}
ent_create("kreuz.mdl",vector(me.x+120,0,0),NULL);
}
action show_cross()
{
ENTITY* cross1 = ent_create("add_shape2.mdl",vector(me.x+120,0,0), NULL);
set(cross1, VISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
cross1.pan = i;
pXent_addshape(me, cross1, PH_BOX);
}
pXent_removeshape(my, 0);
//
// var Motion[6] = { 0,0,0,0,0,NX_D6JOINT_MOTION_FREE};
// pXcon_add(PH_6DJOINT,me,NULL,0);
// pXcon_set6djoint(me,Motion,NULL);
pXent_setbodyflag(me,NX_BF_KINEMATIC,1);
while (1)
{
angle.pan += -8* time_step;
pXent_rotate(me, nullvector, vector(angle.pan,0,0));
wait(1);
}
}
action test_block()
{
pXent_settype(me,PH_RIGID,PH_CONVEX);
ENTITY* mechanik1 = ent_create ("block.mdl", vector(me.x,0,0), spin_wheel1);
ENTITY* mechanik2 = ent_create ("block.mdl", vector(me.x,0,0), spin_wheel2);
ENTITY* mechanik3 = ent_create ("block.mdl", vector(me.x,0,0), spin_wheel3);
ENTITY* mechanik4 = ent_create ("block.mdl", vector(me.x,0,0), spin_wheel4);
//ENTITY* mechanik5 = ent_createlocal ("block.mdl", vector(me.x,0,0), show_cross);
// ENTITY* mechanik6 = ent_create ("kreuz.mdl", vector(me.x,0,0), mechanik_5);
// ENTITY* mechanik7 = ent_create ("kreuz.mdl", vector(me.x,0,0), mechanik_5);
// ENTITY* mechanik8 = ent_create ("kreuz.mdl", vector(me.x 0,0), mechanik_5);
c_setminmax(me);
pXent_setbodyflag(me,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
pXent_setbodyflag(mechanik1,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
pXent_setbodyflag(mechanik2,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
pXent_setbodyflag(mechanik3,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
pXent_setbodyflag(mechanik4,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
// pXent_setbodyflag(mechanik5,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
// Steuerung Schleife
while(1)
{
if (key_j)
{
angle.pan += -8* time_step;
pXent_rotate(me, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik1, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik2, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik3, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik4, nullvector, vector(angle.pan,0,0));
}
if (key_k)
{
angle.pan += 8* time_step;
pXent_rotate(me, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik1, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik2, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik3, nullvector, vector(angle.pan,0,0));
pXent_rotate(mechanik4, nullvector, vector(angle.pan,0,0));
}
wait(1);
}
}