#include <acknex.h>
#include <default.c>
ENTITY* carbody;
ENTITY* tireleft;
var joinbody;
action mybody()
{
carbody=me;
phent_settype (my, PH_RIGID, PH_BOX);
phent_setmass (my, 70, PH_BOX);
phent_setgroup (my, 2);
phent_setfriction (my, 20);
phent_setdamping (my, 40, 40);
phent_setelasticity (my, 50, 20);
}
action lefttire()
{
tireleft=me;
phent_settype (my, PH_RIGID, PH_SPHERE);
phent_setmass (my, 10, PH_SPHERE);
phent_setgroup (my, 2);
phent_setfriction (my, 60);
phent_setdamping (my, 40, 40);
phent_setelasticity (my, 50, 20);
joinbody= phcon_add( PH_WHEEL, carbody, my);
phcon_setparams1 (joinbody, my.x, vector(0, 0, 1), vector(1, 0, 0));
phcon_setparams2 (joinbody, vector(-30, 30, 0), nullvector, vector(50000, 100, 0));
}
void main()
{
level_load("test.wmb");
wait(4);
ph_setgravity (vector(0, 0, -386));
while(1)
{
if(key_w == 0 & key_s == 0 & key_a == 0 & key_d == 0)
{
phcon_setmotor(joinbody, vector(0,50,0), nullvector, nullvector);
}
if(key_a == 1&key_d == 0)
{
phcon_setmotor(joinbody, vector(-100,50,0), vector(0,0,0), nullvector);
}
wait(1);
}
}