hi here..
i just tried to get newton involved, but of course i failed. i tried to adapth the code from the litecnewton demo but the engine crashes as soon as i try to create a physics entity

this is how i start the code
Code:

#include <acknex.h>
#include <default.c>
#include <d3d9.h>

// newton works with meters!
// 1 meter = 32 quants
float QUANTTOMETER = 0.03125;
float METERTOQUANT = 32;

#include "newton.h"
#include "matrix.c"
#include "newton_main.c"
#include "newton_debug.c"

void onforceandtorque(NewtonBody* body)
{
float mass, ixx, iyy, izz;
NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz);
NewtonBodySetForce(body, vectorf(0, 0, -9.8 * mass));
}



this is the code for the entity to be created:
Code:

void erdbeere()
{
my.pan = random(360);
my.tilt = random(60)-30;
my.roll = random(60)-30;
c_updatehull(me,0);
set(my,POLYGON|FLAG2);
while(my.z>-50)
{
wait(1);
}
ent_remove(me);
}



this is how i create the entity:
Code:

you = ent_create("erdbeere.mdl",vector(my.x,my.y,900),kugel);
NewtonBody *body = newton_addentity(you, 10, "convex hull", onforceandtorque); // register entity as physics entity
NewtonBodySetVelocity(body, vectorf(0,0,-100));



and in the main function i have this, which creates a grid of floorparts and starts newton.
Code:

var i,j;
for (i=0;i<10;i++)
{
for(j=0;j<10;j++)
{
you = ent_create("ground_box.mdl",vector(128*(i-5)+64,128*(j-5)+64,0),checkField);
you->flags |= FLAG8;
}
}

newton_start();
on_close = quit;



as soon as i call the entity creating function the engine crashes. any ideas whats my fault here?