Search Unity

Official Upcoming authoring changes for Unity Physics and Havok Physics for Unity

Discussion in 'Entity Component System' started by IsaacsUnity, Apr 4, 2023.

  1. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    94
    Hello everyone, with the release of ECS for Unity just right around the corner, we wanted to provide information about authoring changes between the pre-release (1.0.0-pre.65 and earlier) and the upcoming release versions (1.0.0 and later) of Unity Physics and Havok Physics for Unity. Specifically, in the upcoming releases, we will be moving the custom Unity Physics authoring components (PhysicsBody, PhysicsShape, PhysicsRenderEntity) into the package sample, as a first step towards consolidating our ECS workflows.

    Why are we doing this?
    In prior versions of Unity Physics (1.0.0-pre.65 and earlier), users are able to use custom Unity Physics authoring components (PhysicsBody, PhysicsShape), interchangeably with built-in Physics components (Rigibody, Colliders). As we work on consolidating our ECS workflows, we’re progressing toward a single workflow via the built-in Physics authoring components. This would ensure new and existing users of ECS for Unity can continue leveraging on their existing experience working with the built-in Physics authoring experience to create ambitious games.

    That said, the underlying APIs driving the custom Unity Physics authoring components will still be available, and users can continue to refer and use them via the samples should they choose to. We intend to take some of the usability and design lessons from these custom Unity Physics authoring components and apply them to the built-in Physics authoring components moving forward.

    Mitigating changes to your project
    If you have used the custom Unity Physics authoring components with prior versions of Unity Physics (1.0.0-pre.65 and earlier) and prefer to continue using them, we’ve provided a convenient way for you to import these components into your projects with the next release. Here are the required steps:

    In your open project, navigate to the Unity Physics package in the Package Manager.


    Select the Samples tab, and then click the Import button next to the Custom Physics Authoring sample entry.



    After successful import, the custom physics authoring scripts will appear in your project.




    Sharing feedback
    This forum is the best place to open discussions and ask questions.
    • If you encounter a bug, please use the Unity Bug Reporter in the Unity Editor, accessible via Help > Report a Bug. Include the name of the package (with version number) in the title to help our team triage things appropriately.
    • To learn more about what we are working on, you can refer to this post and our public roadmap where you can share feedback and submit ideas.
    • To participate in conversations with the community, you can visit the #dots-forum channel on our official Unity discord server.
    Thank you again to everyone who has continued to take the time to share feedback. We look forward to hearing from you!
     
  2. DDKH

    DDKH

    Joined:
    Jun 13, 2013
    Posts:
    25
    in Physics Shape Authoring we can adjust the following settings: Collision Filter (Collides with, Belongs to) and Custom tags. I use these intensively in my projects. Will they be available in built-in (legacy) physics components in some form, or we will have to use custom physics authoring?
     
    jakpid, xseagullx, vzlomvl and 2 others like this.
  3. GameFinder

    GameFinder

    Joined:
    Jan 7, 2015
    Posts:
    17
    I have same problem!
     
  4. UniqueCode

    UniqueCode

    Joined:
    Oct 20, 2015
    Posts:
    65
    I was going to ask the same question. The authoring components have more and different settings. Additionally, the baking for the buildin joints was broken for me so I used the joint authoring components from the samples.
     
  5. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    I read this as legacy physics components will no longer be supported, which sounded good.
     
  6. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    94
    With our 1.0 release, you could either implement your own custom authoring solution (since the underlying APIs for these components are still available) or leverage the custom Physics authoring components that we're providing as part of the package samples. In the longer term, we're looking to integrate more of such capabilities into the built-in Physics components to ensure a consolidated experience across all of our Physics offerings. Hope that helps!
     
    jakpid, Kmsxkuse, GameFinder and 2 others like this.
  7. Rand_D

    Rand_D

    Joined:
    Oct 24, 2017
    Posts:
    44
    @IsaacsUnity What about the lisence for Havok in Unity ? Any update on this ?
     
    nicloay likes this.
  8. redwyre

    redwyre

    Joined:
    Oct 14, 2018
    Posts:
    29
    Why is this a sample and not just a separate optional package?
     
  9. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    94
    Would you be asking about the general availability of Havok Physics for Unity? If so, the package continues to be exclusively available and included with Pro, Enterprise and Unity Industry users only. Let me know if this was helpful.
     
  10. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    94
    We wanted a one-click solution that was easily accessible and could effectively help a user re-import these custom authoring components easily. We did consider a package, but alas, it felt like it was adding complexity to the Unity Physics package, hence we opted to distribute it via the samples instead. Hope that helps!
     
    daniel-holz, Arnold_2013 and Occuros like this.
  11. coding_crow

    coding_crow

    Joined:
    Sep 26, 2014
    Posts:
    4
    Are there any plans to make the "constraints" checkboxes in the Rigidbody component get converted too, so we can easily create 2D-physics entities? Or alternatively you could make this workflow apply to Rigidbody2D and the corresponding colliders.
     
    Last edited: May 21, 2023
  12. Aethenosity

    Aethenosity

    Joined:
    Jun 2, 2017
    Posts:
    16
    I feel like it's hidden, which makes it difficult to access and reimport. I suggest, if you want to keep it in the samples tab, that you simply add a note in the description saying:
    "DOTS Custom Physics Authoring Components [are deprecated (or whatever is happening with them)] in favor of the legacy physics components. The components can still be used, and can be imported from the samples tab"
    ..or something less wordy.
     
  13. redwyre

    redwyre

    Joined:
    Oct 14, 2018
    Posts:
    29
    Having to get the user to delete the existing code and then re-import every version is not a good experience, along with having these random files in the project (Under a "samples" folder to add confusion). It's a short term trade off that is going to hurt more as time goes on.
     
  14. redwyre

    redwyre

    Joined:
    Oct 14, 2018
    Posts:
    29
  15. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,147
    Why would a package with a dependency on another package impact the package it depends on?
     
    Anthiese likes this.
  16. coffeebuyer

    coffeebuyer

    Joined:
    Jan 31, 2023
    Posts:
    9
    Is there no performance advantage to using the Unity Physics authoring components in the physics samples over the built in physics components at this point?
     
  17. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    585
    Why would there be a performance difference? Both authoring methods create the same Entities components once baked.
     
    daniel-holz likes this.
  18. coffeebuyer

    coffeebuyer

    Joined:
    Jan 31, 2023
    Posts:
    9
    I did not know this. Thank you
     
    daniel-holz likes this.
  19. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    I totally misunderstood what was going to happen. I don't support this change.
     
    XiangAloha likes this.
  20. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    We included both the built-in physics authoring experience as well as the custom physics authoring experience in the Unity Physics package documentation under Authoring.
     
    One1Guy likes this.
  21. croixbk

    croixbk

    Joined:
    Aug 16, 2015
    Posts:
    5
    How are Joints going to work with this transition? the Physics docs only list the custom authoring options.
    The default joint components leverage of ECS and Havok or only the custom ones?
     
  22. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    The documentation you linked talks about joints that are created with the API. They are independent of the authoring components.

    For joint authoring in the editor you can use the built-in physics joint components (e.g. HingeJoint, SpringJoint, ConfigurableJoint etc.) or the joint authoring components that come with the custom physics authoring.
     
  23. HomeLabourer

    HomeLabourer

    Joined:
    Jul 11, 2022
    Posts:
    3
    All Physics Shape authoring data are missing after upgrade and import the new sample. Is there any tool to keep data intact?
     
  24. mattdymott

    mattdymott

    Joined:
    Dec 27, 2016
    Posts:
    29
    This happened to me as well. I removed unity physics and the sample. Which took it back to 1.0.8 because of a dependency with the CharacterController package. I then upgraded back to 1.0.11 and it worked again.
     
  25. mattdymott

    mattdymott

    Joined:
    Dec 27, 2016
    Posts:
    29
    And now it's back to being broken again!
     
  26. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    Could you make a bug report for this please so that we can resolve this?
    Thanks!
     
  27. mattdymott

    mattdymott

    Joined:
    Dec 27, 2016
    Posts:
    29
    I deleted the Library folder and it's working again. But yea if it happens again I will report.
     
  28. daniel-holz

    daniel-holz

    Unity Technologies

    Joined:
    Sep 17, 2021
    Posts:
    278
    Thank you! If you could somehow deduce or guess the sequence of operations that makes this break next time, that would be fantastic.
     
  29. XiangAloha

    XiangAloha

    Joined:
    Jun 19, 2020
    Posts:
    21
    I just found this thread. Does this mean PhysicsBody and PhysicsShape are deprecated?

    CharacterController package samples still use them. I thought they are intended to replace all built-in physics components.

    So, which one does Unity encourage us to use? Built-in Physics Authoring or Custom Physics Authoring? The fact that Custom Physics Authoring has additional baker scripts, If it is not going to be maintained, everyone can imply that Built-in Physics Authoring is the practical solution.
     
    Last edited: Aug 7, 2023
    Acots96 likes this.
  30. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Built-in is recommended for now. That said, the custom package is still available and does have some features that built-in does not. I believe it is being maintained until built-in reaches parity. At that point it would no longer be needed.
     
    daniel-holz likes this.
  31. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    Because of the differences between Unity Physics and PhysX parity will never happen. I initially thought they were deprecating the legacy physics components because that would have been sensible given the differences in data requirements between the two physics packages.

    This change was a marketing decision and not one based on reality. Joachim Ante had this vision that you could separate the authoring and runtime components and Unity management is running with that. The reality is that the two representations are intrinsically, and fundamentals coupled in ways that make this kind of abstraction unreasonable.
     
    mattdymott likes this.
  32. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    585
    Can you list some of the functionality from Unity Physics authoring that you think cannot be addressed with updates to the components used for PhysX?
     
  33. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    With Entities and Unity Physics, there is no PhysX involved at all. The component is just being converted under the hood. So yes, could receive parity. I'm not sure what approach they will take, however.
     
  34. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    The two physics systems have different data requirements. One big one is Force Unique. Without Force Unique you cannot have non-uniformly scaling of colliders or changing collision filters at run time without affecting the whole blob.

    Collision filters themselves are different from legacy. You have Belongs To and Collides With. Setting World Index. The list goes on and on because the two physic engines are so different.

    At some level, Unity understands this. The docs say “If you’d like to have more fine-grained control over your Physics simulations, refer to the custom Unity Physics authoring components demonstrated in the PhysicsSamples project.” This is basic stuff that every ECS project will need. The issue is for whatever reason this is not getting through to management. Probably because unrealistic expectation where set early on.

    The data is different it will never receive parity.
     
    Last edited: Aug 10, 2023
    mattdymott and XiangAloha like this.
  35. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    It wont receive parity on the PhysX Side. But it could absolutely implement those options in the component and have them only effect Unity Physics. That's the functionality parity I am referring to.
     
    daniel-holz and Spy-Master like this.
  36. TheOtherMonarch

    TheOtherMonarch

    Joined:
    Jul 28, 2012
    Posts:
    866
    Cluttering up a single component with options increases complexity. I doubt Unity will create a workflow with that many superfluous options. If it happens it will likely be more along the line of a context-aware GUI. What is less obvious is what advantages would a single component allow? Seems like only negatives.

    I don’t want to speculate too much about something that may or may not happen. Likely the current components will remain unchanged for many years to come. If ECS physics becomes more than a niche product that could change. As it stands the legacy components simply are not viable.
     
    Last edited: Aug 10, 2023
    mattdymott likes this.
  37. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Agreed. I'm just going off of their announcement when they changed this to a sample package.

    Specifically: "We intend to take some of the usability and design lessons from these custom Unity Physics authoring components and apply them to the built-in Physics authoring components moving forward."
     
    Last edited: Aug 10, 2023