Rope in GS

iTopGamesiTopGames Member Posts: 71
edited May 2012 in Working with GS (Mac)
Hi GS guys, i need to make a rope, just like in "Cut the Rope"

Which is the best way to do it?

Best Answer

Answers

  • blorschblorsch Member Posts: 248
    edited May 2012
  • iTopGamesiTopGames Member Posts: 71
    Yeah i hope joints come with the new engine, take care
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    I posted a link to a demo in this thread:
    http://forums.gamesalad.com/discussion/44274/how-to-make-a-swinging-pendulum-effect#latest

    Hope this helps. (But yes -- it will hopefully be much easier when joints are formally implemented in GameSalad.)

    I wouldnt classify that as a rope at all. Its a pendulum as you said in that thread. And although a nice effect for some stuff, isnt really useful for most any game elements that require a rope. Collisions dont work ect.

    Once theres joints you can make a real rope.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @JohnPapiomitis

    I agree with you. Its a pretty poor rope! But OK as a pendulum. (Or if shortened, as a rope segment.)

    The above demo was something I was experimenting with last December. I did, in one experiment, join a bunch of rope 'segments' together. It got pretty close to cut the rope behavior. If you look closely at cut the rope, each rope is a series of 1/6 inch (1.5mm) segments, alternating light and dark brown.

    But as you indicate, this demo is not set up for collisions. (Because it uses constraints, instead of interpolation.) Also, with a bunch of segments chained together, the framerate drops pretty quickly.

    I agree that once GameSalad implements joints it will be easier to make a rope. But I am worried that their implementation of joints might not work as we hope. For example, what if they can't figure out how to have joints work with collisions either? What if their version of joints also lowers framerates to unacceptable levels.

    Meanwhile, I'm willing to experiment and see what can be done. Its fun to learn new ways to use GameSalad.

    RThurman
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    @JohnPapiomitis

    For example, what if they can't figure out how to have joints work with collisions either?

    RThurman
    Then that wouldnt be a joint haha, so i wouldnt be worried about that one bit.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @JohnPapiomitis

    Joints don't need collision to be defined as a joints. In fact, the pendulum demo I gave is a joint. Its just a 'hand-coded' joint.

    I hope you are right, that is, I hope the good people at GameSalad do figure out how to integrate Box2D joints into the engine. (If they indeed continue to use Box2D as their underlying physics engine.)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    edited May 2012
    @JohnPapiomitis

    Joints don't need collision to be defined as a joints.
    By standard programming practice they do. Thats why i dont consider your a demo a true joint. I just consider that have the object constrained at one point and its rotation based off that. Theres no collisions, you cant move the connected pendulum with touch or anything like that.

    Im not knocking your demo, its a very nice effect and some nice math in there, but in fact in most programming both connected objects have to be a rigidbody to even be able to connect a joint between them, so they have to respond to physics and collisions ect and you cant connect non physics objects with a joint.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited May 2012
    This thread is interesting!

    Here is a demo I made last November. Perhaps it might be of use:

    http://www.mediafire.com/download.php?vwd856cbku8vhpr

    This demo is based upon FireMapleGames' really great "Swinging/Hanging Demo" that can still be found in the new section of GameSalad. (All I did was take the pendulum and make a chain out of it.) It uses a different integration scheme than the demo I posted previously.

    Hope this helps! But I really hope it might spark others to experiment with making joints in GameSalad.

    RThurman
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    edited May 2012
    Sorry, @JohnPapiomitis we must have posted at the same time and I didn't see your comment until now.

    I guess we'll just have to disagree on the definition of a 'joint'. To be honest, I didn't even consider that the definition of a joint needed to include collisions. Sometimes joints need collisions, and sometimes they don't -- depending on the need.

    For example, joints in Box2D (GameSalad's underlying physics engine) do not use collisions by default. In order to get a Box2D joint to register collisions, one needs to explicitly turn on the boolean flag 'collideConnected' or the joint wont ever detect collisions. (But it is still a very valid and useful joint.)

    If they continue to use Box2D, the coders at GameSalad will need to explicitly turn on this boolean variable -- or we many never get joints in GameSalad that collide properly. Either that, or when they get around to creating joint behaviors, they will need to include a "turn collisions on" checkbox that will allow us to designate if the joint needs collisions or not.

    RThurman
  • ApprowApprow Member Posts: 703

    @RThurman Sorry for bringing up this old thread. I'm interested in the demo you made, unfortunately the download link doesn't work anymore. If you still have it, could you upload it here? Thanks in advance!

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Wow... that is an ancient thread! I am not sure I have that anymore. It might be stored on an old USB drive somewhere. But who knows!

    I'm gonna go ahead and close this very old thread. GameSalad is really a very different engine than it was then.

    I would suggest starting a new thread where you can explain your requirements and lets see if the current crop of GS experts can work their magic.

This discussion has been closed.