Constraining 1 actor to another while both rotate in sync with each other.
DigitalDiana
Member Posts: 34
Hello!
I am in need of assistance. Any help would be greatly appreciated! I am having issues with constraining and rotating/orbiting actors in sync with each other as they go around another actor.
What I am working with:
3 Actors
- Actor1 (dot-shaped)
- Actor2 (rectangle-shaped)
- Actor3 (square-shaped)
What I am trying to do:
- Actor 2 rotate/orbit around Actor 1, which does not move (similar to a spinner arrow twirling around its center).
- Actor 3 be constrained to one end of Actor 2 so both Actor 2 and Actor 3 rotate/orbit around Actor 1 together whilst stacked on each other.
-Actor 3 move with end of Actor 2 when Actor 2 is pressed.
What I managed to do:
-Actor 2 is rotating around Actor 1 when Actor 2 is pressed.
-Actor 3 is orbiting Actor 1 when Actor 2 is pressed.
Problem:
-Actor 3 is not constrained to one end of Actor 2.
-Actor 3 does not rotate/orbit together with Actor 2 around Actor 1.
Picture representing problem (just to give somewhat of a visual):
Red = Actor 1 (dot)
Yellow = Actor 2 (rectangle)
Blue = Actor 3 (square)
http://img32.imageshack.us/img32/47/problemexample.png
Videos I referenced to attempt what I was trying to do:
(I tried to constrain Actor 3 to one end of Actor 2 whereas in this video, TSB constrains circles to corners of a square -- But how do you keep the balls constrained to the square if the square rotates/orbits?)
(I tried to have Actor 2 and Actor 3 rotate/orbit around Actor 1 whereas in this video, TSB has the Earth orbiting the Sun -- it works good, but how do I get 2 Actors to orbit at the same time in the same place as each other? Like my Actors 2 and 3 that are stacked on each other?)
(Basically I'm trying to do both. Constrain Actor 3 to the end of Actor 2 and all the while have them both orbit/rotate around Actor 1)
Any suggestions?
I am in need of assistance. Any help would be greatly appreciated! I am having issues with constraining and rotating/orbiting actors in sync with each other as they go around another actor.
What I am working with:
3 Actors
- Actor1 (dot-shaped)
- Actor2 (rectangle-shaped)
- Actor3 (square-shaped)
What I am trying to do:
- Actor 2 rotate/orbit around Actor 1, which does not move (similar to a spinner arrow twirling around its center).
- Actor 3 be constrained to one end of Actor 2 so both Actor 2 and Actor 3 rotate/orbit around Actor 1 together whilst stacked on each other.
-Actor 3 move with end of Actor 2 when Actor 2 is pressed.
What I managed to do:
-Actor 2 is rotating around Actor 1 when Actor 2 is pressed.
-Actor 3 is orbiting Actor 1 when Actor 2 is pressed.
Problem:
-Actor 3 is not constrained to one end of Actor 2.
-Actor 3 does not rotate/orbit together with Actor 2 around Actor 1.
Picture representing problem (just to give somewhat of a visual):
Red = Actor 1 (dot)
Yellow = Actor 2 (rectangle)
Blue = Actor 3 (square)
http://img32.imageshack.us/img32/47/problemexample.png
Videos I referenced to attempt what I was trying to do:
(I tried to constrain Actor 3 to one end of Actor 2 whereas in this video, TSB constrains circles to corners of a square -- But how do you keep the balls constrained to the square if the square rotates/orbits?)
(I tried to have Actor 2 and Actor 3 rotate/orbit around Actor 1 whereas in this video, TSB has the Earth orbiting the Sun -- it works good, but how do I get 2 Actors to orbit at the same time in the same place as each other? Like my Actors 2 and 3 that are stacked on each other?)
(Basically I'm trying to do both. Constrain Actor 3 to the end of Actor 2 and all the while have them both orbit/rotate around Actor 1)
Any suggestions?
Comments
1 actor = Constrain Game x to self x
Constrain Game y to self y
2nd actor = Constrain SELF x to GAME X
constrain SELF Y to GAME Y
Actor 1:
Change Attribute: game.Actor1X To: self.PositionX
Change Attribute: game.Actor1Y To: self.PositionY
Actor 2:
After watching first video, I did this:
Rule: When Actor is Pressed:
Constrain Attribute: self.Position.X To: 1*cos( self.Time *-30%360)+ game.Actor1X
Constrain Attribute: self.Position.Y To: 1*sin( self.Time *-30%360)+ game.Actor1Y
Constrain Attribute: self.Rotation To: vectorToAngle( game.Actor1X - self.Position.X , game.Actor1Y - self.Position.Y )
After watching the second video, I added this to it:
Change Attribute: game.Actor2X To: self.Position.X
Change Attribute: game.Actor2Y To: self.Position.Y
Actor 3:
After watching first video, I did this:
Constrain Attribute: self.PositionX To: 100*cos( self.Time *-33%360)+ game.Actor2X
Constrain Attribute: self.PositionY To: 100*sin( self.Time *-33%360)+ game.Actor2Y
Constrain Attribute: self.Rotation To: vectorToAngle( game.Actor2X - self.Position.X , game.Actor2Y - self.Position.Y )
After watching the second video, I added this to it:
Constrain Attribute: self.PositionX To: game.Actor2X +50
Constrain Attribute: self.PositionY To: game.Actor2Y +0
(Actor 2 is 50 width and 280 Height. I just wanted Actor 3 to be straight up from the center, hence why I did X=+50 and left Y=0.)
Here is a solution for you (but it might seem different from what you have already done). If you can use, great! If not, well... that's OK too.
http://speedy.sh/HPgud/Constraining1ActorToAPointOnAnother.zip
Hope this helps!
RThurman
To RThuman: Yes! That certainly helped! That was exactly it! Thank you so much!!
Thank you both for all your help!!
RThurman
I have found this thread and tried to download your offered solution ZIP-file, but it seems it is no longer available. Since it worked for DigitalDiana, and I have the same issue, I would most appreciate it if you could re-post the ZIP-file link or email it to me.
Thank you in advance
Pete