Distance between objects (not between centres)?
Hi. I'm simulating a robot. I've made a scenario for my robot. It consists in a box with 4 walls. The robot can move inside the box and when it finds a wall in front of itself, it has to turn itself an angle. Obviously, the walls are much bigger than the robot. When I calculate the distance between the robot and a wall (in the iterate method) I can only know the distance between the centre of the wall and the centre of the robot and it is a big problem because sometimes the robot is near from a wall but very far away from the centre of the wall... so I can't know exactely the real distance between the robot and a wall.
So, my question is: how can I determine the real distance between the robot (MultiBody object) and a wall (Stationary object), not only the distance between centres...
Thank you!

Distance between objects (not between centres)?
Assuming that the 4 walls form a square or a rectangle, and that they are axis-aligned, you can use something like this:
Distance between objects (not between centres)?
I have thought in that solution, but it isn't good. If I want to change the scenario (for example adding other wall), I will have to modify this code...
I've chosen the follow solution:
+ to iterate:
vector_distance=wall raytrace from-location (robot get-location) with-direction (robot get-rotation)*(0,0,1).
if (vector_distance!=(0,0,0)){
robot turn.
}
In this way, if I change the scenario, the code will work.
Anyway, thanks for the help.
Distance between objects (not between centres)?
Have a look at the Raytracer.tz demo in the latest betas. I believe it should help do what you want.
- jon