#include <acknex.h>
#include <default.c>
#include <ackphysX3.h>
#define PRAGMA_PATH "C:\\Program Files\\GStudio8\\templates\\sounds";
#define PRAGMA_PATH "C:\Program Files\\GStudio8\templates\models";
#define PRAGMA_PATH "C:\\Program Files (x86)\\GStudio8\\templates\\sounds";
#define PRAGMA_PATH "C:\\Program Files (x86)\\GStudio8\\templates\\models";
SOUND *snd_impact = "aiimpact.wav";
ENTITY* terrain_ent;
// Impact event :
void impact_event()
{
if (event_type == EVENT_FRICTION)
{
ent_playsound ( my, snd_impact,100);
}
}
// App entry point
void main()
{
// Open physX :
physX3_open();
// Load level :
level_load("");
vec_set(camera.x, vector(-253, -6, 128));
camera.tilt = -26;
// Create cube :
terrain_ent = ent_create("water.hmp", vector(0, 0, 0), NULL);
pX3ent_settype(terrain_ent, PH_STATIC, PH_TERRAIN);
}
VECTOR p_target;
VECTOR kick_vec;
void on_space_event()
{
p_target.x=camera.x+cos(camera.pan)*cos(camera.tilt)*50;
p_target.y=camera.y+sin(camera.pan)*cos(camera.tilt)*50;
p_target.z=camera.z+sin(camera.tilt)*50;
you=ent_create(CUBE_MDL, p_target.x, NULL);
pX3ent_settype(you, PH_RIGID, PH_BOX);
you.emask|=(ENABLE_FRICTION);
pX3ent_setcollisionflag(you, NULL,PX_PF_NOTIFY_TOUCH);
kick_vec.x=100;
kick_vec.y=0;
kick_vec.z=0;
vec_rotate(kick_vec,camera.pan);
pX3ent_addvelcentral(you, vector(kick_vec.x, kick_vec.y, kick_vec.z));
you.event=impact_event;
}