Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Multiple physic simulations running in different threads (Bullet or Physx)?

Discussion in 'Physics' started by mauriciosaro, Jun 14, 2018.

  1. mauriciosaro

    mauriciosaro

    Joined:
    Feb 20, 2018
    Posts:
    3
    Out team is using Unity as a simulation for path planning of robot arms. This mainly requires collision checking and other relevant information such as shortest distances between colliders. We also require to be able to access the simulation from various different threads that work at different speeds. For example, arm hardware will be constantly updating the simulation with it's current position every 4-8ms, while sensors might be changing object positions every 8-20 ms from a different thread and the planner querying for collisions in a third thread.

    After much research into the new changes and the new job system added to Unity, I still don't think what we need can be done with Unity and it's default Physx integration.

    Our current solution is to integrate the Bullet physics engine through BulletSharp in Unity with a little help from this package: https://assetstore.unity.com/packages/tools/physics/bullet-physics-for-unity-62991

    We then create a main Bullet world which is in synch with Unity and various copied worlds which are used by the different threads. This require that we move objects in the Bullet simulation from other threads and then synch with Unity in the main thread.

    While the solution works, it requires a major change in the normal Unity workflow which causes the loss of some of the features from Unity.

    I am curious if there is a better or more straightforward approach, or if someone has some experience doing something similar with Unity.

    Thanks in advance
     
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    1,460
    I think you might be jumping ahead of yourself here. Like you don't actually give end reasons why you need what you say you do. You say you want to update some things on different intervals but not why. Like if you just want things to move at different speeds, you don't need any of what you are talking about.

    My guess is what might work well is kinematic controllers you move manually combined with using say ComputePenetration to do simple depenetration. That would likely give you the most fine grained control over everything.