Page 1 of 1

How to get the exact position of a shape using regular API?

Posted: 26 Jun 2020, 07:21
by suri
Hallo Admin,

I need to get the exact position of a shape using regular API. I did not find an API which does exactly what I need!.

I used sim.getOjectPosition(ShapeHandle,-1). But using this API I got the position of blue line in the below image. Kindly have a look.
Image

But I need the position at intersection of green and red line. How can I know what position difference is there between blue(position got from co-ordinate frame) and red line, so then I can add extra difference to linear.x value manually?

In other words, middle position of intersection of two shapes in the above figure.

Basically blue line is the co-ordinate system of that shape, I am assuming it and also position of that shape relative to world frame!

Or else any suggestion to do it in a better way in coppeliasim?

Never mind for my understanding in co-ordinate system.

Thanks in advance.

Re: How to get the exact position of a shape using regular API?

Posted: 26 Jun 2020, 12:07
by coppelia
Hello,

not sure what the blue line represents... or the red and green line in that picture.

The reference frame of a shape is always located in the middle of that shape. If you know the extent of the shape, then you can figure out other coordinates on your shape. You can always use a ray-type proximity sensor to figure out the intersection position between the sensor and a particular shape if needed.

Cheers

Re: How to get the exact position of a shape using regular API?

Posted: 29 Jun 2020, 14:11
by suri
Thanks you so much. I solved the problem with your suggestion/solution.