Creating custom meshes in issac sim

Hey all,

I’ve been working on a custom mesh. I have completed the the points output as a pointf[3]. Not too sure how to progress from here? I also need this to inculde collision physics for the ray cast function. I think i need to make a prim but not sure of how to start this process?

I looked into applying the below

https://docs.omniverse.nvidia.com/app_isaacsim/app_isaacsim/reference_python_snippets.html

thanks all

Hi @Sirens_uk. Apart from the points, you also need to set the FaceVertexCounts and FaceVertexIndices. Here an example that I did creating voxel meshes: vox2usd/_vox2usd.py at c913b5d685ea24335d9da69dfc21b4e87f59742a · matiascodesal/vox2usd · GitHub

UsdGeomMesh documentation explains what these mean: Universal Scene Description: UsdGeomMesh Class Reference

1 Like

Hey Mati,

Sorted the vertex counts and indices via create tube topology and that is working perfectly.

I wanted to ask about the physx collider.

I used a cylinder with collisions enabled which is being detected by the lidar sim and used write properties in action graph to apply my points, vertex counts and indices. It works a treat for the visual side although the collider still picks up the collisions from the origonal cylinder and not the custom mesh…

I wanted to ask how can i generate values for the second section of code that applies the physx collider. I’m pretty sure it will just be a script relating to the triangleMesh, points and primvars:st. How would i go about writing a script for this?

I seen @AlesBorovicka had answered a similar question in the past wondering what is the best way to achieve this ideally in a script node as I’m a bit of a coding novice…

uniform token physics:approximation = “none”
bool physics:collisionEnabled = 1
uchar physxCookedData:triangleMesh:buffer =
point3f points =
float2 primvars:st =
interpolation = “faceVarying”

Thanks all

Hi,
So in order to set an object as a collider to be detected you need to:

  1. Tell the mesh it should be a collider: UsdPhysics.CollisionAPI.Apply(prim)
  2. Now should this mesh be just static or dynamic?
    a) static, nothing additional should not be required
    b) dynamic, approximate with a convex hull:
    mesh_api = UsdPhysics.MeshCollisionAPI.Apply(prim)
    mesh_api.CreateApproximationAttr(UsdPhysics.Tokens.convexHull)

If you are interested only in raycasting, just applying the UsdPhysics.CollisionAPI should be enough.

Regards,
Ales

Thanks Ales,

I’m trying to wrap my head around this. I normally use action graph for my coding with some custom functions in script node.

currently I’ve used a cube but its still only picking up the origonal values and not the dynamic values.

If I go into the usda my code is as follows.

def Mesh “custom_mesh_trial” (
prepend apiSchemas = [“PhysicsCollisionAPI”, “PhysxCollisionAPI”, “PhysxTriangleMeshCollisionAPI”, “PhysicsMeshCollisionAPI”, “PhysxCookedDataAPI:triangleMesh”]

float3 extent = [(-0.5, -0.5, -0.5), (0.5, 0.5, 0.5)]
I think this line is doing the box colloison?

int faceVertexCounts = [4, 4, 4…]
This is coming from my write data in action graph

int faceVertexIndices = [0, 1, 21…]
Same again from write in action graph

normal3f normals = [(0, -1, 0),…]
not sure how thats generated

interpolation = “faceVarying”

uniform token physics:approximation = “none”
bool physics:collisionEnabled = 1
uchar physxCookedData:triangleMesh:buffer = [7, 157, 205,…]

The triangle data is massive so i take it its coming from the meshpoint data and vertex data.

point3f points = [(-1003.41095, -940.0192, 1248.7394),
Just my points in for the mesh, feeding these in via action graph via the write function

float2 primvars:st = [(1, 0), (0, 0),]
Not sure about this data

interpolation = “faceVarying”

Here is the connections im using in action graph. these do work as the mesh visual element is correct

and you can see the incorrect collisions
wrong collsions

Like i mentioned previously I’m a coding novice. I dont mind writting code in the usda if required.

I also tried changing the phsyics settings to covex hull, the data was still incorrect.

Any help here would be great, I’m struggling with this and its the end of a long process working on this problem…

thanks again

Scott

Ok I see so the problem could be order of operations, if you apply the CollisionAPI and then modify the indices/points later on the changes wont be propagated.
You should generate your mesh and then apply the UsdPhysics.CollisionAPI then it should generate the collisions on the mesh.
The collision is generated from the points/indices only.