After spending some time looking at newton.wdl and newtonscript2.wdl, I decided to add my own physics with bullets system, and it works quite well, the objects seem to move right and I can change how powerful the bullet is. Only problem is, the crates I'm using go through walls (I tried two levels, the same, except only one let it sink a bit into the floor). I've tried tweaking values, no difference (using NewtonBodyAddImpulse).

Here's the code, I just got it from the NewtonGSScriptEvent... and changed it to take shots from an entity rather than a trace. Here's the script:

Code:
 

var newtonImpulseRecord[8];

function ApplyGravityForceEvent(body)
{
dll_handle=newtonHandle;
var bodyMass;
bodyMass = NewtonGetBodyMass(body);
NewtonBodyAddForce(body, bodymass * 100, 0, bodyMass * newtonGravity);
}

function bullet_hit()
{
if(you.skill1 == 4)
{
var body;
body = NewtonGetBody (my);
newtonImpulseRecord[0] = you.x;
newtonImpulseRecord[1] = you.y;
newtonImpulseRecord[2] = you.z;

// copy origin of bullet (use to determone the direction of the impulse)
newtonImpulseRecord[3] = you.skill9;
newtonImpulseRecord[4] = you.skill10;
newtonImpulseRecord[5] = you.skill11;

// copy the bullet mass
newtonImpulseRecord[6] = 10;

// copy the bullet speed
newtonImpulseRecord[7] = you.skill8*10;
NewtonBodyAddImpulse (body, newtonImpulseRecord);
}
wait(2);
}

function enable_physics(material)
{
var collisionType;
var body;
dll_handle = newtonHandle;

// if entity is not destructible. Set health very heigth

// check for collision type
collisionType = my.collision_sph_box;
if (my.compound_collision == 1) {
// compound collision,
// use my entity for center object center
// use children entities for collision geometry
collisionType = 3;
}

// entity with zero mass habe infite health
if (my.mass == 0) {
my.health = MAX_VALUE;
}

// if the water density is not specify, make 0.8 that of the water
if (my.shape_factor == 0.0) {
my.shape_factor = 0.9;
}

body = NewtonAddMapEntity (my, collisionType);
NewtonSetBodyMass (body, my.mass);
NewtonSetBodyLinearDamp (body, my.linear_drag);
NewtonSetBodyAngularDamp (body, my.angular_drag_x, my.angular_drag_y, my.angular_drag_z);
NewtonSetBodyForceAndTorque (body, ApplyGravityForceEvent);
NewtonSetBodyMaterial (body, material);
NewtonSetBodyActiveState (body, my.start_active);


my.ENABLE_impact = ON;
my.EVENT = bullet_hit;
}

Action PhysicsCrateNewton
{

my.skill96 = 1;
my.skill98 = 1;
my.skill99 = 1;//I'm a physics object
enable_physics(wood_material);
}




I've set mass to 10 here, linear and angular x y and z to 0.1. For the moment skill8 belongs to the bullet, it is 100. Multiplying it by 10 is the result of tweaking values, which I have done both for newtonImpulseRecord[6] and newtonImpulseRecord[7]. skill9, skill10 and skill11 of you (the bullet), are the bullet's starting coords, where it was created (skill9 to x, skill10 is y and skill11 is z).

Those of who who've looked at newtonScript2.wdl will notice it's very similiar. What am I doing wrong? Or is it Newton?