jorgejgnz / HPTK

Hand Physics Toolkit
MIT License
338 stars 31 forks source link

DOTS physics support #4

Open chris-rgr opened 3 years ago

chris-rgr commented 3 years ago

Understandably, HPTK was built for 'classical' Unity physics. Unity's new DOTS ecosystem includes a new physics system, however, which is quite different from the 'old' system due to the general nature of DOTS. I have only had a short glance at the documentation but it seems that the Physics system is (again, understandably) very tightly/centrally integrated into this package. Is this correct? How much work do you estimate is necessary to make this work with HPTK - would it be feasible or essentially require a complete rewrite?

jorgejgnz commented 3 years ago

Support to Unity DOTS won't be included as I only have access to DOTS packages for a limited time and HPTK is intended to be used also by people who don't own a Unity Pro license.

If you want to add support to DOTS, it would be required to:

  1. Make a slave hand (ragdoll hand) using DOTS physics colliders, rigidbodies and joints.
  2. Implement a new HandPhysics module valid for DOTS physics.
  3. Implement CollisionNotifier, TriggerNotifier and PhysHelper equivalents for DOTS physics.
  4. Modify SlaveHandModel and SlaveBoneModel to include references to these new colliders, joints, rigidbodies and collision notifiers
  5. Modify InteractorController to listen to these new collision notifiers.

The rest of HPTK modules that don't use physics (Core, Avatar, ProxyHand, Input, etc.) will still be valid with DOTS.

chris-rgr commented 3 years ago

Thanks for your quick reply and the hints on where to get started. As a quick side note: DOTS is open for everyone and does not require a Pro license. I will evaluate whether a port makes sense and is feasible for me to do (work-load wise) in the coming year - I will post here in case I do.

KellanHiggins commented 3 years ago

DOTS is amazing and it is the future of Unity! But they are trying their best to bridge the gap between the two spaces. I think in 2 - 3 years most of Unity will be DOTS-centric.

jorgejgnz commented 3 years ago

DOTS is open for everyone and does not require a Pro license

Great to know thank you! I should start playing around with DOTS. I've read that Unity's plans are to move from PhysX to DOT's based Unity Physics so this issue is important if we want HPTK to be valid for future Unity's versions.

chris-rgr commented 3 years ago

DOTS is very worthwhile for performance critical and/or parallel tasks! That said, it can still be a bit of a nuisance to work with as they're still working on the tooling. I honestly doubt they will completely get rid of PhysX in the foreseeable future - just like GameObjects and MonoBehaviour it is so central to so many projects that dropping support for it would lead to major backlash.

KellanHiggins commented 3 years ago

@chris-rgr For sure, it is gonna be a slow transition away, but PhysX isn't gonna get any new features or anything. They are focused on Unity Physics and Havoc now.