Vehicles in Newton 3.14?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Vehicles in Newton 3.14?

Postby Leadwerks » Sat Nov 28, 2020 11:26 am

What is the best way to create vehicles in the final Newton 3.14? There are several demos:
- Heavy vehicle
-Construction vehicle
-Single-body car
-Super car
-Multi-body car

There is also a dVehicleManager folder in the SDK.

Which should be used?
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm

Re: Vehicles in Newton 3.14?

Postby Leadwerks » Sun Nov 29, 2020 7:29 am

I'm trying with the MultiBodyVehicle interface, but so far I have no vehicle motion. I only added tires and differentials, no engine or anything else:

Code: Select all
   bool PhysicsVehicle::Finalize()
   {
      Mat4 localframe;
      Mat4 tiremat;

      delete newtonvehicle;
      tires.clear();

      newtonvehicle = new dMultiBodyVehicle(chassis->newtonbody, &localframe[0][0], chassis->world->gravity.y);
      newtonvehicle->SetUserData(this);

      for (int n=0; n < tireinfo.size(); ++n)
      {
         tiremat.t.x = tirepositions[n].x;
         tiremat.t.y = tirepositions[n].y;
         tiremat.t.z = tirepositions[n].z;
         tires.push_back(newtonvehicle->AddTire(&tiremat[0][0], tireinfo[n]));
      }

      for (const auto& axle : axles)
      {
         newtonvehicle->AddDifferential(1, 1, tires[axle.x], tires[axle.y]);
      }

      newtonvehicle->Finalize();
      return true;
   }
User avatar
Leadwerks
 
Posts: 569
Joined: Fri Oct 27, 2006 2:54 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 42 guests