Hello,
My goal is to retrieve the orientation and position of normal to every surface on a shape, and I'm pretty sure the API needed is sim.getShapeMesh, but not sure how it works.
For example, for a pure shape cuboid, it gives me normals like below:
{0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0}
but why are there so many values while the cuboid only has 6 surfaces? Thought it should be only 6 normals?
Do they represent orientations of the normals? Then how may I get the position of every normal (Like at the center of mass in every surface)?
Excuse for my poor presentation, thank u.
How sim.getShapeMesh works?
Re: How sim.getShapeMesh works?
Those are 36 normals = ( 3 normals / triangle ) * ( 2 triangles / face ) * ( 6 faces )allen0413 wrote: ↑20 Feb 2021, 10:14 For example, for a pure shape cuboid, it gives me normals like below:
{0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0}
It is one normal for each triangle's vertex, so normals will be duplicated for vertices shared by multiple triangles, e.g. in the above case a cuboid has only 8 vertices, but because of the triangle count, you get 36.