I have a working car physic with Newton but it uses 1.53. I dunno what are the diffrences between 1.53 and 2.16 so the code i gave is working at 1.53. I have shown simply how to use torque, how to set the car etc. Making better steering formulas, rpm-torque formulas or similar things can be made as you wish. Hope it will be useful for the community. And btw, nice contribution and great work by you VET smile

Code:
var temp_var;
float temp_float;

ENTITY* car;
ENTITY* FLwheelPtr;
ENTITY* FRwheelPtr;
ENTITY* BLwheelPtr;
ENTITY* BRwheelPtr;
ENTITY* tireId;
ENTITY* tireModel;
D3DXMATRIX m;

void tireUpdate(NewtonJoint* vehicle)
{
	// FOR EACH TIRE APPLY THESE VALUES
	for (tireId = NewtonVehicleGetFirstTireID (vehicle); tireId!=NULL; tireId = NewtonVehicleGetNextTireID (vehicle, tireId)) 
	{
		NewtonVehicleSetTireSideSleepCoeficient(vehicle,tireId,0.0);
		NewtonVehicleSetTireMaxSideSleepSpeed (vehicle,tireId,999.0);
		NewtonVehicleSetTireLongitudinalSlideCoeficient(vehicle,tireId,0.0);
		NewtonVehicleSetTireMaxLongitudinalSlideSpeed (vehicle,tireId,999.0);
	}
	
	
	// CALCULATE AVERAGE TIRE SPEED
	tireId = NewtonVehicleGetFirstTireID(vehicle);
	temp_var = NewtonVehicleGetTireLongitudinalSpeed(vehicle,tireId);
	tireId = NewtonVehicleGetNextTireID(vehicle, tireId);
	temp_var += NewtonVehicleGetTireLongitudinalSpeed(vehicle,tireId);
	tireId = NewtonVehicleGetNextTireID(vehicle, tireId);
	temp_var += NewtonVehicleGetTireLongitudinalSpeed(vehicle,tireId);
	tireId = NewtonVehicleGetNextTireID(vehicle, tireId);
	temp_var += NewtonVehicleGetTireLongitudinalSpeed(vehicle,tireId);
	temp_var *= 0.25;
	
	
	if(key_w)
	{
		if(temp_var<-2) //if tires average speed is smaller than -2 and key W pressed  >>>>>> APPLY BRAKE TO ALL TIRES
		{
			tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 2   //Back Left
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 3   //Back Right
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
		}
		else //else >>>>>> APPLY 1500 TORQUE FORWARD TO REAR TIRES 
		{
			tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left	
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 2   //Back Left
			NewtonVehicleSetTireTorque(vehicle,tireId,1500);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 3   //Back Right
			NewtonVehicleSetTireTorque(vehicle,tireId,1500);
		}
	}
	else if(key_s)
	{
		if(temp_var<2) //if tires average speed is smaller than 2 >>>>>> APPLY 1500 TORQUE BACKWARD TO REAR TIRES 
		{
			tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left	
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 2   //Back Left
			NewtonVehicleSetTireTorque(vehicle,tireId,-1500);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 3   //Back Right
			NewtonVehicleSetTireTorque(vehicle,tireId,-1500);
		}
		else //else >>>>>> APPLY BRAKE TO ALL TIRES
		{
			tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 2   //Back Left
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
			
			tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 3   //Back Right
			temp_float = NewtonVehicleTireCalculateMaxBrakeAcceleration(vehicle,tireId) * 0.7;
			NewtonVehicleTireSetBrakeAcceleration(vehicle,tireId,temp_float,temp_float);
		}
	}
	
	
	
	if(key_a) //if key A >>>>>> SET FRONT TIRES ANGLE TO 0.35 RADIAN
	{
		tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,0.35);
		
		tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,0.35);
	}
	else if(key_d) //if key D >>>>>> SET FRONT TIRES ANGLE TO -0.35 RADIAN
	{
		tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,-0.35);
		
		tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,-0.35);
	}
	else //else >>>>>> SET FRONT TIRES ANGLE TO 0.0 RADIAN
	{
		tireId = NewtonVehicleGetFirstTireID(vehicle);        //tireId 0   //Front Left
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,0.0);
		
		tireId = NewtonVehicleGetNextTireID(vehicle, tireId); //tireId 1   //Front Right
		NewtonVehicleSetTireSteerAngle(vehicle,tireId,0.0);
	}
	
}

action Newton_Car()
{	
	car = me;
	while(!newton_running){wait(1);}
	
	NewtonBody* car_body = newton_addentity(me, 1000, NEWTON_CONVEXHULL, tireRubberID, onforceandtorque);
	NewtonBodySetAutoFreeze( car_body, 0);
	NewtonBodySetLinearDamping(car_body,0.005);
//	NewtonBodySetAngularDamping(car_body,vectorf(0.5,0.5,0.5));


	float upDir[3] = {0.0, 0.0, 1.0};
	NewtonJoint* car_joint = NewtonConstraintCreateVehicle(nworld, upDir[0], car_body);
	
	
	int tireMass = 30;
	float suspensionLength = 0.25;
	float suspensionSpring =700.0;
	float suspensionShock = 60.0;
	float wheelradius = 0.4;
	float tirePin[3] = {0.0, 1.0, 0.0};
	D3DXMATRIX tire_offset;
	VECTOR tirepos;
	
	vec_for_bone(tirepos,me,"FLBone");
	vec_sub(tirepos,my.x);
	D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER);												
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin[0], tireMass, wheelradius, wheelradius, suspensionShock,suspensionSpring,suspensionLength, FLwheelPtr, 5);
	
	vec_for_bone(tirepos,me,"FRBone");
	vec_sub(tirepos,my.x);
	D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER);		
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin[0], tireMass, wheelradius, wheelradius, suspensionShock,suspensionSpring,suspensionLength, FRwheelPtr, 5);
	
	vec_for_bone(tirepos,me,"BLBone");
	vec_sub(tirepos,my.x);
	D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER);		
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin[0], tireMass, wheelradius, wheelradius, suspensionShock,suspensionSpring,suspensionLength, BLwheelPtr, 5);
	
	vec_for_bone(tirepos,me,"BRBone");
	vec_sub(tirepos,my.x);
	D3DXMatrixTranslation(&tire_offset, tirepos.x * QUANTTOMETER,tirepos.y * QUANTTOMETER,tirepos.z * QUANTTOMETER);		
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin[0], tireMass, wheelradius, wheelradius, suspensionShock,suspensionSpring,suspensionLength, BRwheelPtr, 5);
	
	NewtonVehicleSetTireCallback(car_joint, tireUpdate); 
	

	while(me!=NULL)
	{
		// SET ALL TIRES POSITION AND ANGLE [ THESE LINES ARE NOT AT TIRE CALLBACK FUNC. BECAUSE MAKING THAT CAUSES VISUAL TIRES TO UPDATE 1 FRAME LATER THAN NEWTON TIRES ]
		for (tireId = NewtonVehicleGetFirstTireID (car_joint); tireId!=NULL; tireId = NewtonVehicleGetNextTireID (car_joint, tireId)) 
		{
			tireModel = NewtonVehicleGetTireUserData (car_joint, tireId);
			NewtonVehicleGetTireMatrix(car_joint,tireId, m);
			ent_setmatrix_rb(tireModel,m);
		}
		
		wait(1);
	}

}

For the creation of models:
Code:
	FLwheelPtr = ent_create("tekerlekL.mdl",nullvector,NULL);
	FRwheelPtr = ent_create("tekerlekR.mdl",nullvector,NULL);
	BLwheelPtr = ent_create("tekerlekL.mdl",nullvector,NULL);
	BRwheelPtr = ent_create("tekerlekR.mdl",nullvector,NULL);
	
	you = ent_create("350z.mdl",vector(6500,-1200,1100),Newton_Car);




PS:
Code:
// FOR EACH TIRE APPLY THESE VALUES
	for (tireId = NewtonVehicleGetFirstTireID (vehicle); tireId!=NULL; tireId = NewtonVehicleGetNextTireID (vehicle, tireId)) 
	{
		NewtonVehicleSetTireSideSleepCoeficient(vehicle,tireId,0.0);
		NewtonVehicleSetTireMaxSideSleepSpeed (vehicle,tireId,999.0);
		NewtonVehicleSetTireLongitudinalSlideCoeficient(vehicle,tireId,0.0);
		NewtonVehicleSetTireMaxLongitudinalSlideSpeed (vehicle,tireId,999.0);
	}

I don't exactly know how the values should be or their min,max values at these lines of tire Callback. But it just works fine with these also.

Last edited by YNG; 03/15/09 15:21.