USD collision in 5.4

Hi, I’m trying UE 5.4.0, love the new stuff!
But I have a problem with enabling collision on imported USD asset.
I can import asset via Content Browser in 5.3.2 and enable Simple or Complex collision in Static Mesh editor.
If I open copy of same project in 5.4.0, the existing asset still has collision, but if I import a new USD asset using the same process I cannot enable collision on the new asset. Similar result using USD Stage Editor.
However I CAN import an FBX asset and enable collision on that asset.

Any advice welcome and apols if this is not the right place to post, only been using UE 3-4 weeks.

What do you mean by you cannot enable collision?
By default you will not have collision set up for the simple collision, you will have to generate it in the static mesh editor.

In 5.4, support for collision was implemented, so UE can read collision from the USD file. This support was added through the implementation of the following schemas:

  • UsdPhysicsCollisionApi: to specify meshes/prims as colliders
  • UsdPhysicsMeshCollisionApi: to specify collision shapes on meshes/prims

Hello All.

I’m having the same problem.

5.3 works fine, I can generate simple collision in the static mesh editor with no problems and use complex as simple and everything works fine. However. in 5.4, a third person BP will only collide with a box simplified generated collision. Any other generated type will not work including using complex as simple.

AS 5.4 can read the collision file from the USD, for custom collisions that’s great but how does this get specified? Is it something in the USD exporter or can we simply build and name them correctly the way it works for fbx. At the moment I’m having no luck, so I’d appreciate any suggestions.

Thanks

Oh…I should also mention it doesn’t seem to matter whether the assets are on the USD stage or I import them in using the import on the stage window, I still get the same issue.

In 5.4

If you want to add collision you need to add the good schemas to your prim and then the token physics:approximation value and the physics:collisionEnabled boolean

over "pCylinder380" (
            prepend apiSchemas = ["PhysicsCollisionAPI", "PhysicsMeshCollisionAPI"]
        )
        {
            uniform token physics:approximation = "boundingCube"
            bool physics:collisionEnabled = 1

approximations values are
image

If you want to use another mesh as your collision mesh :

  • Meshes that represent collision shapes should be sibling from rendering mesh
  • These meshes should have the “guide” purpose
  • These meshes must use the “PhysicsCollisionAPI”, “PhysicsMeshCollisionAPI”. They should also use the none approximation
 def Mesh "Duck" (
        prepend apiSchemas = ["PhysicsCollisionAPI", "PhysicsMeshCollisionAPI"]
        prepend references = @Assets/Game/USD/Duck.usda@
    )
    {
        token visibility = "inherited"
        matrix4d xformOp:transform = ( (1, -0, 0, 0), (0, 1, -0, 0), (0, 0, 1, 0), (-80, -150, 20, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform"]
    }

    def Mesh "Box" (
        prepend apiSchemas = ["PhysicsCollisionAPI", "PhysicsMeshCollisionAPI"]
        prepend references = @Assets/Game/Box.usda@
    )
    {
        token visibility = "inherited"
        matrix4d xformOp:transform = ( (1, -0, 0, 0), (0, 1, -0, 0), (0, 0, 1, 0), (-70, -150, 20, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform"]
        uniform token purpose = "guide"
        uniform token physics:approximation = "none"
    }

    def Mesh "Sphere" (
        prepend apiSchemas = ["PhysicsCollisionAPI", "PhysicsMeshCollisionAPI"]
        prepend references = @Assets/Game/Sphere.usda@
    )
    {
        token visibility = "inherited"
        matrix4d xformOp:transform = ( (1, -0, 0, 0), (0, 1, -0, 0), (0, 0, 1, 0), (-50, -150, 100, 1) )
        uniform token[] xformOpOrder = ["xformOp:transform"]
        uniform token purpose = "guide"
        uniform token physics:approximation = "none"
    }

The cube and sphere will be used as collision meshes for the duck

Thanks UE_FlavienP for your detailed answer regarding importing collisions from the usd file. But, what about simply creating them in the static mesh editor? This used to work in 5.3, and in your original answer to norv2001 I got the impression it should still work. I’ve attached a couple of images below to illustrate the problem (sorry about the large size)

In the first image you can see I have auto generated a simple collision but this is completely ignored. In the second image I’ve generated a simple box collision and this works. As you can see I’ve reset the collision preset on the instance because this always defaults to no collision now, and I’ve set it to block dynamic in the static mesh editor. In 5.4 the only generated collision that appears to work is the simplified box and it doesnt matter whether its on the USD stage or if you import the stage to the project.

If I’m missing something really obvious, my apologies, but like I say this works in 5.3.

Thanks for your help


Apparently it is linked to that option that is ticked in the static mesh details in 5.4. I will check with Dev why did it changed.

Edit: Now that you can specify if a part has collision we actively deactivate some settings if the collision info is not present in USD. Hence the collision preset change and the Never Needs Cooked Collision Data.

1 Like

Ah, OK. Thanks for looking into it. Got it working now.