About rotate actor

ElsaftyElsafty Member Posts: 33
edited March 2012 in Working with GS (Mac)
hi guys, so i have problems when actor(x) rotate around another actor(y) which rotate around itself in ad-hoc. When I stop games and play the postion actor(x) around the actor(y) change .how i can fix that?

Comments

  • POMPOM Member Posts: 2,599
    When I stop games and play
    What do you mean ?

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    If you out from games and then play again on your iPhone
  • POMPOM Member Posts: 2,599
    edited March 2012
    Im really sorry for misunderstanding what you ask ..
    You say your actor(x) is rotating around actor(y) , then you 'go out from the game' and 'come back to it' and you actor(x) position is changed ?
    Changed how? does it stop rotating around actor(y)? please be more specific ..
    Also what rule you use for the rotation?

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    edited March 2012



    ...
  • POMPOM Member Posts: 2,599
    Still don't follow ... you say actor(y) is rotating around itself , meaning he's X and Y value stays the same , meaning he doesn't move ! how can he change his position ?

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    Im very sorry, i mean that,
    1- actor(y) rotate about itself by use rotate rule.

    2- actor(x) rotate about actor(y) by using :
    (Constrain the actor's X position to . . . AAA*cos(self.time*BBB)+CCC
    Constrain the actor's Y position to . . . AAA*sin(self.time*BBB)+CCC

    AAA = the radius of the orbit.
    BBB = how fast it moves.
    CCC = the centre of the orbit.)

    3- I need actor(x) to rotate about actor(y) by same rotate speed of actor(y) about itself. So, the actor(x) will be in fix postion around actor(y) when actor(y) rotate.

    4-the problems is the postion of actor(x) changed when Out from the game and come back
  • POMPOM Member Posts: 2,599
    edited March 2012
    Ok , i see the problem now , your problem is the sync rotation between the two actors .
    (if you just said the word "sync" i would probably understand it earlier :) )
    So what i suggest is to use GAME.TIME instead of Self.Time in your actor(x)

    As for actor(y) , replace the "rotate behavior" with
    Constrain self.rotation TO Game.time*DDD

    DDD- a number - you need to make some tests to find the right number to sync with your actor(x) but maybe (just maybe) your BBB value will do it ;)

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    Thanks for your help ,I will try it
  • ElsaftyElsafty Member Posts: 33
    It worked thank you again. But I have little one question, How I changed the postion of actor(x) around the acto(y)
  • POMPOM Member Posts: 2,599
    edited March 2012
    Well , since your actor(x) movement is based on constrains and its rely on a game clock , i don't think you can .. cause the constrain will override every change you make ..
    if you describe what you trying to do maybe ill be able to be more helpful .

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    I make Gear teeth which rotate , and I need the every Gear teeth round in fix rotation
  • ElsaftyElsafty Member Posts: 33
    Sorry in fix postion
  • POMPOM Member Posts: 2,599
    edited March 2012
    If you want different "gear teeth" to be at a different location around the center, you need to add an offset to each teeth ..
    In your equations , you need to add an extra to the "Game.time"
    Constrain the actor's X position to . . . AAA*cos((game.time+0.2)*BBB)+CCC
    Constrain the actor's Y position to . . . AAA*sin((game.time+0.2)*BBB)+CCC

    Each gear will have to have a different "extra" value .

    My suggestion is to make a self.attribute - real - call it "my offset"
    Now make your equations like this :
    Constrain the actor's X position to . . . AAA*cos((game.time+"self.my offset")*BBB)+CCC

    And in each instance (each teeth) give "self.my offset" a different value .

    Photobucket Roy
  • ElsaftyElsafty Member Posts: 33
    Thanks for your help again
Sign In or Register to comment.