Hi Emerson,
Scaling the models for either NetwonVehicle or NewtonTire is a little more complicated.
Since Newton does not consider the scaling factor of the transformation, I do this scaling internally in NewtonPhysics and store a table of scaling factors for all of the added IPhysicsObject including NewtonVehicle.
For any IPhysicsObject other than NewtonVehicle, I rescale the transformation got back from Newton in the default transform callback I defined in NewtonPhysics, but since you're supposed define your own transform callback for NewtonVehicle, this scaling
factor is not applied unless you apply the scaling yourself in the callback.
To do this, first add a function called GetScale in NewtonPhysics.cs in the Goblin XNA framework:
public Vector3 GetScale(IntPtr body)
{
if (scaleTable.ContainsKey(body))
return scaleTable[body];
else
return Vector3.One;
}
Then, modify line 72 in the transform callback for the car in RaceCar.cs as following:
Matrix mat = Matrix.CreateScale(engine.GetScale(body)) * MatrixHelper.FloatsToMatrix(matrix);
I updated the SVN repository to deal with car model scaling, so you can also get the modified code from SVN (NewtonPhysics.cs and RaceCar.cs)
For rescaling the tire models, I need to investigate a little more since it can be more complicated, so for now, it's best to use the original size of the tire model (rescale it using a modeling software like GoogleSketchUp if necessary).
Ohan
