Hi,
I want to know how to calculate if the Position of an object is to the left or right relative to another object.
Thanks for your replies.
Hi,
I want to know how to calculate if the Position of an object is to the left or right relative to another object.
Thanks for your replies.
I can be easy or tough, it depends on how you rotate the objects. If you have smooth rotations you need more than trivial math ( matrices, angles, pi). but if you have like four positions (facing N, S , E, W) you just need simple positions substracting
My project`s facebook page is “DreamLand Page”
Thanks for the reply. I want to rotate an object towards another object. If the target object is on the left side relative to the other object the object should rotate clockwise towards the target object. If it is on the right side relative to the other object the object should rotate counter clockwise.
I have included a picture to help explain what i mean.
I c what you`re saying. Basically if we refer strictly to the situation you depicted
if(RO.x > TO.x) TO object to the left
if(RO.x < TO.x) TO object to the right
My project`s facebook page is “DreamLand Page”
Get direction of object relative to another object… say
vector dir = objwhichSide.posiition - obj_reference.position
get rightVector of obj_reference…
if rightVector (dotproduct) dir == -1 object is at left
if rightVector (dotproduct) dir == 1 object is at right