Using Physics / Orbit to Make a Hanging Object Swing When Hit

1 favourites
  • 2 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi Construct community! I've been looking for a information on how to do this and I cannot find it. Based on what I know of the tools, I know it can be done; I just do not know where to start.

    Concept:

    I am trying to make a hanging light (think like in an interrogation room) and the player can hit the light and it begins to sway from its long chord. Then comes back to a stop based on gravity.

    1. I'd want the light to swing on a pivot (end of the chord) which is probably going to mean creating a second origin point.

    2. The lighting mask i have working perfectly, and have pinned that to the bulb on start of layout... but when I change the origin point, it gets pinned to the chord rather than the origin point of the bulb.

    3. I don't want it to swing violently, just a light sway... even set limits so it only sways to a set coordinate on either side and then come back to neutral via gravity.

    So:

    a. I know I need two origin points on the light fixture (one for the pivot, one to pin the lighting mask to)

    b. Apply gravity to the light fixture

    c. Use Orbit(?) so that the light fixture can rotate along a pivot point?

    d. Apply an on click or on touch event to trigger the light fixture

    e. Find a way to pin the lighting mask to the origin point of the bulb (not the chord)

    I tried a number of things and read some tutorials about the concepts above, but I just cannot get it to work. I do not want to go the animation route as that would just add more graphical weight to my game and I would like to keep it light.

    Any help, directions, pointers, links would be greatly appreciated.

    Thank you.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I used Pin(rope style) and combine with Physics:

    crazygames.com/game/hit-red-button

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)