🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Determine if Position of object is to the right or left Relative to Abiture object

Started by
6 comments, last by Calin 4 years, 4 months ago

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.

Advertisement

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”

@Calin

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

why two threads for same query…….

Enzio599 said:

why two threads for same query…….

happened to me too, the software is a bit confusing.

My project`s facebook page is “DreamLand Page”

This topic is closed to new replies.

Advertisement