Search code examples
c#wpf3dogreviewport3d

How to implement rigid body dynamics previewed by WPF 3D


I'm currently facing a problem with WPF 3D using C#. To put it simple, I need to animate some simple mechanical part by only moving two of them (one at a time or both together). Here is a simple drawing depicting the situation :

sketch

So by moving (translating) vertically P1 or/and P2 parts, the whole thing needs to move accordingly.

I guess it may be possible to do by computing a lot of angles and applying numerous transformations but this is not my goal.

Therefore I would imagine something like attaching the parts together by the means of a pivot point.

What is the preferred way to do this to preview it using WPF 3D?


Solution

  • WPF 3D, Ogre, Mogre, OpenTK... are libraries for display. They have nothing to do with mechanical constraints calculations. But they goes well with physics engines.

    WPF 3D is a subset of WPF dedicated to 3D drawing. If you need 2D, then WPF is enough.

    As your project looks 2D, you might want to have a look to Farseer Physics which is a port of Box 2D. The feature you need is called joints. Both libraries target 2D games development, but they can be used for simple kinematics animations, and Farseer Physics is doing very well with WPF.