0 Favourites

Physics pivot chain

  • I'm trying to link this red object to the green wall with gray chains using physics behaviour (with pivots).

    I can't get it to work at all.

    <img src="https://dl.dropbox.com/u/1024727/c2/chain.PNG" border="0">

    <img src="https://dl.dropbox.com/u/1024727/c2/chainevent.PNG" border="0">

    chained.capx

    The result for me:

    <img src="https://dl.dropbox.com/u/1024727/c2/messychain.PNG" border="0">

  • I didn't take a look at your capx but here is a example that you can compare against:

    http://www.scirra.com/forum/a-rope-on-a-roller_topic49497_post311730.html#311730

  • R0J0hound, Yeah I've based my understanding for this from that, but its not working which is why I need help.

  • Firstly, it may not be id'ing them correctly from left to right..

    if you leave "order by: " blank, then I assume it will pick them based on the order they were created within the layout editor.

    so either make a system that creates the chain objects on startup inbetween 'Red' and 'wall', or for now you can simply do "order by chain.x ascending", this will pick them from left to right.. (so bare in mind that this wont work if you want the chain to go in other directions)

    next there are some picking problems with chain and link..

    Im not sure if you just followed example, or you figured out for yourself, but the reason it's good to use a family here is to help make it clear what instances your action is referring to.

    For example having "chain: create joint to chain" will make it confused as to what chains to pick

    but having "chain: create joint to link" means that, in the conditions, you can specify what chain, and specify what link. Even though a link is just a chain, it allows you to pick two seperate chains. It's awkward, yes :)

    so anyway..

    link: id ? 3

    should be

    chain: id ? 3

    and for the last two events you just need to be consistent with whether your choosing link or chain.

    the "link:id=0" event i think is fine, but the "link:id=3" event then goes on to refer to a chain instead.

    for simplicity and ease of reading the sheet i'd replace all occurences of 'link' in those last two events with 'chain' instead

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Your events should look like this:

    <img src="http://dl.dropbox.com/u/5426011/fixed/alspal_pivot.png" border="0" />

  • Thanks guys. I feel so stupid now, such basic mistakes!

  • Just realised, if you use:

    'For each chain order by distance(chain.x,chain.y,red.x,red.y) ascending'

    then it will order the chains going from red, regardless of direction.. so you can have it going up right down etc.

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