• Advertisement
Sign in to follow this  

Positioning objects relatively

This topic is 657 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Say I have  a parent object and I want to position its child base on where the parent go something like this

 

relative_2.jpg

 

Usually i position objects base on screen origin.

 

relative_1.jpg

 

 

Is there a way to position objects or how to position objects base on the parents origin and not screen origin?

Share this post


Link to post
Share on other sites
Advertisement

Just use the parent origin?

 

child.x = parent.x + offset;

child.y = parent.y + offset;

What is the offset?

is it the origin from the parents origin to childs origin? 

Share this post


Link to post
Share on other sites

 

Just use the parent origin?

 

child.x = parent.x + offset;

child.y = parent.y + offset;

What is the offset?

is it the origin from the parents origin to childs origin? 

 

 

The offset is the number you want to move your child based on the parent.

 

So if:

parent.x = 25;

offset = 5;

 

AND

child.x = parent.x + offset;

 

THEN

child.x = 30;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement