Loading STL files in PhysX #171
-
Hi, I recently started working on a project with the goal of leveraging the accelerated collision detection provided by PhysX. I am working with robotic arms and a fairly static collision scene. I am able to create the collision scene using primitive objects (box, spheres, etc). For the arms, I have STL files for the different links. I was wondering if there is a way to load the STL files directly into PhysX ? If not, do you have any suggestions on how I can load the link meshes into PhysX ? Thank You |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi, PhysX does not support 3d file formats directly. Only cooked data can be stored and loaded natively by PhysX. For file formats like STL, you would need to use a third party parser or write your own. There should be good code available on github, maybe the following repo is useful https://github.com/dacunni/stlloader. Also the STL file format is not that difficult, a custom parser can be written quite quickly. Once you get the vertex and index lists out of the STL, one can create PhysX objects out of them. E. g. the SDF snippet, which is part of the PhysX SDK, shows how to create a PhysX object out of vertex and index list. I highly recommend to look at the snippets since they are designed to show how to set up PhysX. Hope that helps |
Beta Was this translation helpful? Give feedback.
Hi, PhysX does not support 3d file formats directly. Only cooked data can be stored and loaded natively by PhysX. For file formats like STL, you would need to use a third party parser or write your own. There should be good code available on github, maybe the following repo is useful https://github.com/dacunni/stlloader. Also the STL file format is not that difficult, a custom parser can be written quite quickly. Once you get the vertex and index lists out of the STL, one can create PhysX objects out of them. E. g. the SDF snippet, which is part of the PhysX SDK, shows how to create a PhysX object out of vertex and index list. I highly recommend to look at the snippets since they are desi…