Flip/Rotate Constrains
m.b.
Member Posts: 21
Hello,
I'd appreciate if anyone can help me out.
I have a main actor(parent) and a child actor.
With a tap motion the main actor rotates 90 degrees clockwise. With a swipe motion it flips vertically/horizontally.
How do I constrain the child actor so when the main actor rotates or flips the child actor follows accordingly?
Answers
What does 'flip' mean in this context ?
Reversed (mirror image).
I'll try to explain myself better with the photos attached.
So when you flip what happens to the child actor's image, it flips, it moves without flipping, it rotates 180° . . . ? (you've removed the image (text) from the flipped version so it's impossible to know what it's doing).
I've attached 2 images (flip.jpg and rotate.jpg) that explains exactly what happens and what I want it to happen.
I saw the images, but like I say as you've removed the actor's image (text saying 'CHILD ACTOR') it's impossible to know exactly what it's doing.
He wants the first of your three options when the actor is flipped, based on his posts so far.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I don't know why no one understands me.
I have 2 actors placed one on top of the other.
All the rules for the rotate/flip are inside Actor1.
So, I want to constrain Actor2 so when I rotate/flip Actor1, Actor2 moves accordingly.
I need the 2 actors to act as one.
People understand you, but there is a lot you're not explaining - most particularly the point @Socks brought up. Different interpretations would be implemented in fairly different ways. You say "move accordingly" but what that means could be any of the three things @Socks illustrated. You've still not specified which one you mean. A lot of people to provide help on these forums are wary of tackling unclear problems - more often than not we'll spend time figuring out a solution to then be told something different to described was what was actually wanted.
Why, though, do you need two actors? This would be trivial with one.
Additional questions:
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Is this what you mean ? .. if it is , i dont think this is the right way to do it , but if you dont find a solution this might help.
Yes, that's exactly how I want it to move when I rotate it. But you're right, it's not the right way to do it
It won't work if I place Actor2 in a different corner. And, I also need it to move correctly when I flip it vertically or horizontally.
Thank you anyway
Okay, so we're getting closer to a proper idea of what you want. In addition to what you've described so far, it need to work regardless of the relative positions of the two actors.
But we're still not clear on what "move correctly when I flip it vertically or horizontally" means. Does actor 2 flip too, or just move?
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I need it to be 2 actors for the purpose of the game.
To answer your questions:
*Actor1 will remain stationary in its initial position (where ever I place it).
*Yes, Actor2 will always be tied to the same actor.
*No, sometimes there will be 2-3 copies of Actor2 attached. However, they will all be inside Actor1 (just on different corners). I'm assuming the same constrains will apply for all the copies.
When I say flip vertically or flip horizontally I mean exactly that. Just imagine the two actors as one image. Where would the small rectangle(Actor2) move to when it rotates or flips.
Okay, to better understand me I am sending you my demo.
There are 2 squares. The first square is exactly how I want everything to move. However the first square is one actor. And I need there to be two actors.
The second square is made up of two actors, however I don't know how to constrain Actor2 so it would move accordingly.
Tap/double tap to rotate the squares and swipe left/right or up/down to flip them.
You've not proved sufficient information for someone to invest their time working out a solution for you, you've still not answered the question of whether the child actor moves, flips or rotates to its new position, its very very common for a question to be asked on the forum - for someone to then work out a solution - only to then have the OP tell them the solution won't work because of some factor not mentioned in the original question . . . this literally happens every day, perhaps multiple times every day, when I see a question where there could be numerous interpretations and the OP hasn't really gone into any kind of detail (more often than not, not even providing basic information) I'll just close the thread, but occasionally I'll try and find out what's need . . . as you can see there are various interpretations of what you are after, and it's also not uncommon for a solution to one interpretation to not also work for another interpretation.
In fact the actual logic / code is more often than not trivial (a solution for your requirements could probably be done with a couple of constrains and a little trigonometry), it's often more work trying to make sense of a question.
Hope than makes sense.
I provided a demo and you still don't have sufficient information???
Yes, the demo helps, my post was in response to your earlier (pre-demo) comment.
Attached is a very quick constrain example (file attached below) for the rotation element of your question - click to rotate - I'll leave the flip element to someone else as all my questions will probably drive you mad
Thank you for the example. I appreciate it.
However, your constrains are very limited.
If for example the size of the child actor is different then the one in your example or if I place the child actor in a different corner, it doesn't work.
The equation isn't limited at all, simply change the angle / radius of the cos and sin functions to place the child actor whereever you need it to be.
Okay, can you please explain to me how you came up with the numbers and what they represent?
55.9 is the distance in pixels between the parent actor and child actor's centre point.
(minus) 63.5 is the angle in degrees between the parent actor and child actor's centre point
Thank you so much.