reference:
http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=684.0

Hi Ejs community, chance to give some tips how to implement
when the blue object (centre is ox,oy) with height h and width w is hitting the lower tip of the inner jaws ( oxmin,oymin) for example that it will be blocked?

my existing strategy adapted from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1189 uses the condition (ox<=oxmin+w/2&&oy>oymin-h/2) { // check left boundary true to make blue object fit into the jaws  ox=oxmin+w/2;  which is necessary when it is inside the jaws say oy>oymin-h/2.
but i can't figure out a way to make the boundary detection different from below and when inside the jaws because i am stuck cos both conditions i am using (ox<=oxmin+w/2&&oy>oymin-h/2)
chance to help?
Thanks!
the picture for the context of understanding the codes below [img]http://www.phy.ntnu.edu.tw/ntnujava/index.php?action=dlattach;topic=1313.0;attach=1492;image[/img]
my object codes
// to check boundary of blue object with the parts of the vernier caliper
if(ox<=oxmin+w/2&&oy>oymin-h/2) { // check left boundary true

ox=oxmin+w/2;

if(x2+x<=ox+w/2&&oy>oymin-h/2){ // check object and jaws to stop motion&& object y above object y minimum

x=w;
}

}
if(x<0)x=0; // for the 2 jaws to meet at zero


else if((ox>x2+x-w/2)&& (oy>oymin-h/2) &&  (oy < oymax-h/2) ){ // right jaw hit object and inside jaws

  ox=x2+x-w/2; // to force the blue object into the open jaws
}

if(oy>oymax-h/2)oy=oymax-h/2; // check top boundary codes changes to suit lookang thinking