Constrain one actor to specific point on another actor?

NtGNtG Member Posts: 103
edited May 2012 in Working with GS (Mac)
Simply put: I have a circle that constantly spins, and I want another actor to be constrained to a specific point so that it rotates with the circle.

Imagine a frying pan spinning in a circle where the handle is a different actor than the actual pan itself.

Suggestions?

EDIT: I have tried using TShirtBooth's orbiting tutorial, but it doesn't give me the effect that I want

Best Answer

  • JohnPapiomitisJohnPapiomitis Posts: 6,256
    Accepted Answer
    constrain self position x to cos(main.rotation+offset)+main.position.x
    constrain self position y to sin(main.rotation+offset)+main.postion.y
    constrain self rotation to main.rotation

    main represents the actor you want it to be constrained to. Offset represents a number to offset it by. You can also do 10* in front of cos and sin in the expression to add a offset there. If you do that make sure the number your multiplying by is the same in the x and y expression, it doesnt have to be 10 though it can be anything. Play around with the offset and youll get it perfect.

Answers

  • NtGNtG Member Posts: 103
    try this



    cheers

    Correct me if I am wrong, but I don't think that would work if the square was rotating.
  • RPRP Member Posts: 1,990
    If you already have the actors constrain behaviors set (there are multiple vids on this on youtube), you can just have the "handle" actor rotate via actor attributes. Go to the motion section and change the Angular Velocity to any speed you choose. For example 10 would be slow in a counter clockwise direction, while -10 would alter it clockwise.
  • NtGNtG Member Posts: 103
    hmmm, good point.

    You may need to include cos and sin and I'm NO good at that.

    sry man.

    Ughhh lol, AP Calculus, we meet again.
  • NtGNtG Member Posts: 103
    edited May 2012
    constrain self position x to cos(main.rotation+offset)+main.position.x
    constrain self position y to sin(main.rotation+offset)+main.postion.y
    constrain self rotation to main.rotation

    main represents the actor you want it to be constrained to. Offset represents a number to offset it by. You can also do 10* in front of cos and sin in the expression to add a offset there. If you do that make sure the number your multiplying by is the same in the x and y expression, it doesnt have to be 10 though it can be anything. Play around with the offset and youll get it perfect.

    Wow, works perfectly! Thanks so much!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    @tshirtbooth thanks man :)

    @NtG

    No probs glad i could help
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    This just saved me so much! Yay!
Sign In or Register to comment.