///////////////////////////////
#include <acknex.h>
#include <default.c>
#include <ackphysX.h>
///////////////////////////////
function main()
{
physX_open();
level_load("room.WMB");
}
action easy_wheel()
{
ENTITY* shape2 = ent_create("add_shape.mdl",me.x,NULL);
set(shape2, INVISIBLE);
c_setminmax(me);
pXent_settype(me,PH_RIGID,PH_SPHERE);
var i;
for (i=10; i<360; i+=72) {
shape2.roll = i;
pXent_addshape(me, shape2, PH_BOX);
}
pXent_removeshape(my, 0);
var Motion[6] = { 0,0,0,0,NX_D6JOINT_MOTION_FREE,0};
pXcon_add(PH_6DJOINT,me,NULL,0);
pXcon_set6djoint(me,Motion,NULL);
}
action my_wheel()
{
pXent_settype(me,PH_RIGID,PH_CONVEX);
ENTITY* shape2 = ent_create("add_shape.mdl",me.x,NULL); // Simple box für die Zähne
set(shape2, SHOW);
c_setminmax(me);
// Insgesamt 5 Zähne werden Gebraucht mit 10° anfangs Winkel
var i;
for (i=10; i<360; i+=72) {
shape2.roll = i;
pXent_addshape(me, shape2, PH_BOX);
}
pXent_removeshape(me, 0); // entfernt eine zuvor hinzugefügte PH_SPHERE Form
pXent_setbodyflag(me,NX_BF_KINEMATIC,1); // aktiviert kinematische Steuerung
// Steuerung Schleife
ANGLE angle;
while(1)
{
if (key_j) {
angle.roll += -8* time_step;
pXent_rotate(me, nullvector, vector(0,0,angle.roll));
}
if (key_k) {
angle.roll += 8* time_step;
pXent_rotate(me, nullvector, vector(0,0,angle.roll));
}
wait(1);
}
}