How can I create a scene that a gear rolling along the track? RackAndPinionJoint seems not meet the requiremen

Continuing the discussion from How can I create a scene that a gear rolling along the track? RackAndPinionJoint seems not meet the requirement:

type or paste code here

I dont think the current rack and pinion joint would simulate the rolling on the track out of the box.
There are two possibilities how to simulate it:

  1. update the prismatic joint axis when the body moves to new track, this would require some position tracking and code to update the axis.
  2. Implement the behavior using custom joint. For 104.1 release we plan to expose custom joint definitions through C++ extensions. So you would be able to implement a custom joint behavior using a C++ code.

But to simulate this out of the box, I dont think its possible with the current rack and pinion implementation.

thank you for the details.
I decide to using the curve to replace the tracks, is there a way that make the curve correspond to the tracks, and can I modify the curve like the train track?

Curves are not really supported by physics, you would have to get from the curve the current position and derive the prismatic joint axis from that, I never tried using curves yet.

There are extensions that let you generate the curves as far as I know but its mostly for visual effect.

I have solved this problem by changing the gear and track with SDF, now it can move just like I expected!
There is another question I want for an answer, are there any ways that can simulate the force that the gear or track bears like the picture below? I have tried the SimulationExtension, but it seems for the aerodynamics, can you give me some ideas?

In theory one could use the contact reporting, since there you can get to the contact pair impulse. However I tried it with SDF on the release that should get out soon and it was crashing for me. I did created a Jira ticket and we will try to fix it for next release.

Looks like in current public release based on Kit 103.5 this might actually work. Please look at physics contact report demos how to register a contact report. Window->Simulation->Demos, contact report demo.