Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"2D Physics - Low Level API" - Is there a 3D equivalent planned?

Discussion in 'Physics' started by PhilSA, May 12, 2017.

  1. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Just saw this in the roadmap

    It sounds super interesting, and definitely something we could use in 3D physics as well. Is there a 3D equivalent in the works?

    To the best of my knowledge, PhysX does have a notion of "collision shapes" that are used by actual colliders. So I'm guessing it would be pretty realistic to add support for this in 3D as well
     
    Last edited: May 12, 2017
    hippocoder likes this.
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    To be honest I would like 2D and 3D to have a lot of parity too, favouring the 2D api style as the leader as it's modern and well thought out unlike the ancient legacy 3D design. This is no offence to the current developers, just it got designed a long, long time ago.

    being able to get contacts from a rigidbody, filtering them so custom character controllers and more are feasible... avoiding garbage from hacky OnCollisionStay stuff is also a bonus...
     
  3. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I think I remember a very recent Unity dev post in the forums (by @MelvMay ) that said the Physics teams are having a meeting next week to discuss feature parity between 2D and 3D, as well as other stuff (presumably things related to the new Physics.Simulate() feature and deeper API access). Fingers crossed

    Actually, I think you were in that thread too
     
    Last edited: May 12, 2017
  4. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I am everywhere with eyes on all the things! I'm watching you too. Seriously tho, a lot of perf issues aren't even the physics engines, but how unity works with them.

    There is also the shift from making Unity brain dead easy to use to making Unity actually useful for developers that know what they are doing (which includes asset store authors who can trickle that down to end users who don't).
     
    iileychen and PhilSA like this.
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,321
    Previously 2D & 3D physics has evolved separately for many reasons, one being that it doesn't make sense to hold features back on one system if the other system hasn't implemented it. Sometimes you've just got to "DOWIT" for it to be seen as something that should be used on the other system.

    This year however, we're making real efforts to ensure that both sides give a heads-up on future work and share design info. It might not mean that features land at the same time but it will mean that we can keep roadmaps aligned where it makes sense. I recerntly wrote-up about the low-level primitive stuff and shared it with the 3D physics team for feedback. Right now I'm prototyping various aspects of it.

    Talking about 2D physics for a moment though; high-level features will be taking a back seat and replaced with exposing low-level constructs that empower more knowledgable devs and allow asset store devs to create 2D physics features that are compatible with all existing 2D physics features and components using the low-level backbone we'll provide. This is starting with the low-level api stuff, exposing primitive shapes and gizmos, native custom collider being composed of those shapes, job-based async batched queries, low-level primitive intersection tests, super fast contact events, multithreaded 2D physics, manual simulation etc.

    Unity has tried for a long time to provide out-of-the-box components but these always come at the expense of devs who want more control. Low-level access will give them that. You can think of this as moving towards a physics pipeline similar to the rendering pipeline with it being driven in C# but with the low-level heavy lifting done in native C++. It'll also be dog-fooding as any new features will be based upon this low-level stuff where possible.

    There have been significant under-the-hood changes in Unity in the last 12 months which makes this possible so now is the time to DOWIT.

    NOTE: So yeah, there's a huge get-together for devs from 20th May for a week. During that time I'll be meeting with a bunch of devs, discussing stuff like the 2D/3D roadmap in general and more specific stuff such as the fast contact events to replace the sluggish and leaky OnCollision/OnTrigger callbacks. We'll also be working on a prototype for the job-based async batched queries.
     
    PhilSA and hippocoder like this.
  6. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sounds awesome! :D
     
  7. iileychen

    iileychen

    Joined:
    Oct 13, 2015
    Posts:
    103
    Can't wait the low-level of 2d physics, sound very good for my game.
     
  8. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    This is really a great thing to hear. I have definitely noticed that Unity has been moving towards more low-level APIs lately. There's the Playables API for animation, the NetworkTransport layer of UNET, the Navmesh LLAPI, the ScriptableRenderingPipelines, etc... These things are exactly what we need, and so far they've been extremely useful to us.

    Leaving some of the higher-level features and the "you don't even have to know how to code"-esque things to asset store devs seems like an ideal solution to me. That way, everyone wins
     
    Last edited: May 13, 2017
    MelvMay likes this.
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Yeah, guess what guys? There's a name for it: Middleware.

    Turns out, it's pretty good!