#include <acknex.h>
#include <default.c>
#include <ackphysx.h>
#define PRAGMA_PATH "Audio"
#define PRAGMA_PATH "Models"
#define PRAGMA_PATH "Scripts"
#define PRAGMA_PATH "Images"
#define PRAGMA_PATH "Shaders"
#include "ballactions.c"
function main()
{
physX_open();
level_load("Level01.wmb");
on_cuu = yimpulse;
on_cul = xleftimpulse;
on_cur = ximpulse;
}
action ball()
{
ent_ball =me;
physx();
kamera();
}
und die ballsteuerung:
VECTOR ball_force;
ENTITY* ent_ball;
function yimpulse();
function ximpulse();
function xleftimpulse();
function physx()
{
pXent_settype(me, PH_RIGID, PH_SPHERE);
pXent_setfriction(me, 70);
pXent_setdamping(me, 10, 10);
pXent_setelasticity(me, 10);
while(1)
{
ball_force.y = -(key_cur = key_cul)*10*time_step;
ball_force.x = 0;
ball_force.z = 0;
pXent_addtorqueglobal(me, ball_force);
my.y = 0;
wait(1);
}
}
function kamera()
{
while(1)
{
camera.x = ent_ball.x;
camera.y = ent_ball.y -200;
camera.z = ent_ball.z +50;
camera.tilt = -20;
camera.pan = 90;
camera.arc = 90;
wait(1);
}
}
function yimpulse()
{
{
pXent_addvelcentral(ent_ball, vector(0,0,0250));
}
return;
}
function ximpulse()
{
{
pXent_addvelcentral(ent_ball, vector(0100,0,0));
}
return;
}
function xleftimpulse()
{
{
pXent_addvelcentral(ent_ball, vector(-0200,0,0));
}
return;
}