Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move parent zone without child zone #207

Open
ecopika opened this issue Aug 25, 2014 · 1 comment
Open

Move parent zone without child zone #207

ecopika opened this issue Aug 25, 2014 · 1 comment

Comments

@ecopika
Copy link

ecopika commented Aug 25, 2014

Hey guys!!

I'm trying to drag a parent zone and keep the child zone statically, and I can't find any solution.

I will be very glad, if anybody can help me with this.

EcoPik@

@kiwistrongis
Copy link
Contributor

Um, the whole point of the parent/children thing is that the child inherits its parent's transformations.
Anyways, I guess this is how you'd do it:

void touchParent( Zone zone){
  PVector v1 = child.getOrigin();
  parent.drag();
  PVector v2 = child.getOrigin();
  PVector difference = PVector.sub( v1, v2);
  child.translate( difference.x, difference.y);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants