Anyone can help me with... Please....

yunxhinyunxhin Member Posts: 14
edited November -1 in Working with GS (Mac)
I have a hanging red ball in my scene and when a ball hit the red ball, I want the red ball swing back and then swing back forward and back to its place.
The swing distance will be according to the collision power.
Here's the image:
http://s3.postimage.org/9oc1ss3wu/help.jpg

Really get frustrate with this. Anyone can help? Thanks before.

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    Ah, you want a pendulum type activity. I'm not sure if this is possible.

    I would maybe try this, and this is most likely the worst way to do this;

    I'd have a 'hinge' actor that has a constrain attribute on it;
    constrain game.hingeX and game.hingeY to self.position.X and self.position.Y

    I'd have your ball and 'string' actor one actor.

    Then I'd have a constrain attribute for the ball/string actor to attach itself to the 'hinge' actor.

    When the soccer ball hits the red ball you'd have a real attribute generated that gives it a value based on how hard it hits.

    Then have a magnitude on the hinge actor that rotates it in the counter and/or clockwise rotation (based on where the ball comes from and how it hits it). And the rotation would be based on the real attribute from the force of the ball.

    This would rotate the hinge, which would rotate the ball/string actor.

    In my head this makes sense. Hopefully, it does to you too. Or at least gets you headed in the right direction...

    Good luck
  • yunxhinyunxhin Member Posts: 14
    Aghh... still got headache.
    I still can't figure how I get value based on how hard it hits?
    Are the swing will work only with magnitude, or I should use cos & sin for the position.
    Anyway, thanks for your feedback.
Sign In or Register to comment.