Firstly thanx a lot for this great plug-in ventilator. It really works perfect. Also i wonder if someone succeeded to make a workin car physics. I tried doin somethng but thre is a problem about the tire pin. Also suspensions are like wood blocks. If someone knows how to fix these i will be real glad. Tnx..

Code:

action Newton_Car()
{
	while(!newton_running){wait(1);}
	wait(1);
	NewtonBody* car_body=newton_addentity(me, 200, 2, 2, onforceandtorque);
	
	D3DXMATRIX upside;
	D3DXMatrixTranslation(&upside, 0.0, 0.0, 1.0);
	NewtonJoint* car_joint = NewtonConstraintCreateVehicle(nworld, &upside, car_body);
	//NewtonVehicleSetTireCallback(car_joint, tireUpdate); 
	
	int tireMass;
	float wheelradius;
	tireMass =  20;
	wheelradius = 0.5; 
	
	D3DXMATRIX tire_offset;
	const float tirePin[3];
	tirePin[0]=0.0;
	tirePin[1]=0.0;
	tirePin[2]=1.0;

	//front left
	D3DXMatrixTranslation(&tire_offset, 40.0 * QUANTTOMETER,
				           -65.0 * QUANTTOMETER,
				           -50.0 * QUANTTOMETER);
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin, tireMass, wheelradius, wheelradius, 300,2000,1.5, NULL, 0);
	
	//front right
	D3DXMatrixTranslation(&tire_offset, -40.0 * QUANTTOMETER,
					    -65.0 * QUANTTOMETER, 
                                            -50.0 * QUANTTOMETER);
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin, tireMass, wheelradius, wheelradius, 300,2000,1.5, NULL, 1);
	
	//back left
	D3DXMatrixTranslation(&tire_offset, 40.0 * QUANTTOMETER,
				            65.0 * QUANTTOMETER,
					   -50.0 * QUANTTOMETER);
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin, tireMass, wheelradius, wheelradius, 300,2000,1.5, NULL, 2);
	
	//back right
	D3DXMatrixTranslation(&tire_offset, -40.0 * QUANTTOMETER,
				             65.0 * QUANTTOMETER,
					    -50.0 * QUANTTOMETER);
	NewtonVehicleAddTire(car_joint, &tire_offset, tirePin, tireMass, wheelradius, wheelradius, 3,20000,1.5, NULL, 3);
}



P.S: the 4th parameter at ventilators newton_addentity function defines the newton material for the entity, it aint no mistake

Last edited by LaQroix; 07/09/08 16:51.