Create dummies on mesh programmatically

Typically: "How do I... ", "How can I... " questions
Post Reply
zorro
Posts: 27
Joined: 06 Nov 2023, 09:31

Create dummies on mesh programmatically

Post by zorro »

Hello!

I am trying to automatically generate some dummies on a complex object surface. I want to implement a functionality similar to the plugin "create dummies on mesh surface" using code, but I am unsure if this can be achieved through the API. The object I am working with is a massive space station model, and I want to generate numerous dummies uniformly on its surface according to my specifications. These dummies will be used for subsequent robotic arm crawling operations. I need to ensure not only that the generated dummies are on the mesh surface but also that their z-axis is perpendicular to the corresponding surface (the "create dummies on mesh surface" feature can achieve this, but I am unsure if it can be implemented using the API).

Therefore, I would like to know if it is possible to realize this idea using the CoppeliaSim API.

fferri
Posts: 1230
Joined: 09 Sep 2013, 19:28

Re: Create dummies on mesh programmatically

Post by fferri »

The way the Create dummies on mesh add-on works is by creating a proximity sensor pointing towards the mesh (from the camera viewpoint).

You can see implementation of function rayCast() here and copy it and adapt it to your needs.

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Create dummies on mesh programmatically

Post by coppelia »

Hello,

you can easily achieve this by using a ray-type proximity sensor of very large size, and placing it appropriately. Then simply use sim.checkProximitySensor upon it in order to retrieve the possible intersection with your object(s) and the normal vector. Make sure your proximity sensor is explicitly handled.

Cheers

Post Reply