Opening of a hinge

SANDEEP410SANDEEP410 Member Posts: 46
edited June 2012 in Working with GS (Mac)
I have a hinge which is at rest at horizontal position.When a ball will strike the hinge the hinge should open to allow the ball to pass and close again.Any1 knows how to get the angle of rotation of hinge

Best Answer

Answers

  • SANDEEP410SANDEEP410 Member Posts: 46
    any1 any idea
  • ZoytZoyt Member Posts: 374
    I'm not really getting your question. Are you talking about the angle of the door in relationship to the hinge or what?
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    The hinge's rotation is: self.rotation.

    Try this -- make a ball actor and a hinge actor. Make the hinge actor long and narrow and place it in the center of your scene. Both the ball and and the hinge should be moveable.

    Shoot the ball up toward the right side of the hinge. (Use whatever method you choose.)

    In the hinge put the following behaviors

    Collide:
    -- Bounce when colliding with actor of type ball
    Constrain Attribute:
    -- Constrain Attribute: self.Position.X To: game.Screen.Size.Width/2
    Constrain Attribute:
    -- Constrain Attribute: self.Position.Y To: game.Screen.Size.Width/2
    Rule:
    -- When: Attribute: self.Rotation > 90
    ----Rotate To Angle:
    ------Angle: 0
    ------Relative to: scene
    ------Speed: 180
    ------Run to completion (check)
    ------Stops on destination (check)
  • SANDEEP410SANDEEP410 Member Posts: 46
    [URL=http://www.imagebam.com/image/ec75f5194270571][IMG]http://thumbnails25.imagebam.com/19428/ec75f5194270571.jpg[/IMG][/URL]
    The hinge rotate about pivot point.Hinge should open according to position of the ball and go back to rest after contact. Angle A is what i need to determine
    Anyway to get the angle or make hinge rotate accordingly
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Yes... angle A really is self.rotation

    Did you try what I suggested? It will give you the hinge. It will give you the door. The door will open when hit by the ball. The door will close when (self.rotation > 90).

    Try it! You will see!
  • SANDEEP410SANDEEP410 Member Posts: 46
    for this method to work i need to make my hinge density to zero and when i do that my hinge goes to a circular rotation when the speed of the ball is too high even though i have put selfrotation >90 rule
  • SANDEEP410SANDEEP410 Member Posts: 46
    wow thx great demo
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    Glad its working for you!

    RThurman
  • SANDEEP410SANDEEP410 Member Posts: 46
    For some reason my hinge keeps on spinning about its pivot point.Also anyway to make hinge not to rotate in downward direction
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    I am not sure how you have things set-up.

    For example, you mention that it rotates in a downward direction. (I assume that means it is rotating in a clockwise direction.) You might have some initial rotation set (to make it rotate clockwise) that needs to be removed. Or it might be something else.

    I would suggest posting a video, or posting a screenshot of your behaviors, or providing a link to the game for downloading. That way we can see what the issue is.
Sign In or Register to comment.