Schaut jetzt so aus:
entity* ball;
var total_score;
action p_ball
{
ball = my;
my.scale_x = 1.5;
my.scale_y = my.scale_x;
my.scale_z = my.scale_x;
def_physic();
}
function def_physic
{
phent_settype (ball, ph_rigid, ph_sphere);
phent_setmass (ball, 80, ph_sphere);
phent_setfriction (ball, 40);
phent_setdamping (ball, 80, 80);
phent_setelasticity (ball, 80, 50);
while(1)
{
vec_set (temp, nullvector);
temp.z = 0;
vec_rotate (temp, vector(camera.pan, 0, 0));
vec_normalize (temp, 200 * time);
phent_addtorqueglobal (ball, temp);
wait (1);
}
}
function main()
{
time_smooth = 0;
fps_max = 140;
fps_lock = on;
load_level("index.wmb");
wait (3);
ph_setgravity (vector(0, 0, -7888));
while (1)
{
phent_settype (ball, 0, 0);
wait(1);
camera.x = ball.x;
camera.y = ball.y;
if(key_w)
{
ball.y -= 20 * time;
}
if(key_a)
{
ball.x += 20 * time;
}
if(key_d)
{
ball.x -= 20 * time;
}
def_physic();
wait(1);
}
wait(1);
}
Aber bekomme den Fehler "Entity not a physics object in def_physic: phent_addtorqueglobal(ball, temp)".