okay, here it is
Code:
void MHonforceandtorque(NewtonBody* body)
{
float mass, ixx, iyy, izz;
NewtonBodyGetMassMatrix(body, &mass, &ixx, &iyy, &izz);
NewtonBodySetAutoFreeze (MH.NewtonChar, 0);
vec_set(temp_vec,vector(MH.keyX*100, MH.keyY*100,-mass*5));
vec_rotate(temp_vec,MH.model.pan);
NewtonBodySetForce(MH.NewtonChar,vectorf(temp_vec.x,temp_vec.y,temp_vec.z));
// damping
NewtonBodySetLinearDamping (MH.NewtonChar, 0.9);
// rotating
NewtonBodySetOmega(MH.NewtonChar, vectorf(0,0,-MH.mouseX*5));
// // speed limit
NewtonBodyGetVelocity(MH.NewtonChar, velocity);
temp_vec2.x = velocity[0];
temp_vec2.y = velocity[1];
temp_vec2.z = velocity[2];
// NewtonBodySetVelocity(MH.NewtonChar,vectorf(temp_vec2.x,temp_vec2.y,temp_vec2.z));
}
function player_init()
{
// MH.model = me;
MH.handler = handle(MH.model);
MH.NewtonChar = newton_addentity(MH.model, 10, NEWTON_SPHERE, MHonforceandtorque);
NewtonBodySetMassMatrix (MH.NewtonChar, 10.0, 10.0, 10.0, 10.0);
NewtonBodySetAngularDamping (MH.NewtonChar, vector(100,100,100));
}
PS:i use omega to move entity exactly as mouse moves ;-)