Figured out how to do joints

dotsonj23dotsonj23 Member Posts: 316
edited November -1 in Working with GS (Mac)
So I have a working template for a joint, except that am having trouble making it react exactly as would with Gravity if was not a work around. I know they are coming out with joints soon. So why am I working on this? Cause it challenges me. Anyway, I have no problem now rotating an rectangular actor around one of it's corners like a joint, I am using a bone system, I created along with some of the math in the post about freeing yourself from the tyranny of center rotations. Anyway, it's been a lot of fun. I would, however, like to work with one of the actual math gurus to make this work with gravity or at least simulate it. I know, joints are coming. But I am in it to the learning and exploration experience. So if you are interested in collaborating cause you just like challenges, let me know. My goal is to release everything free to the community even if the specific application will soon be moot b/c I figure it could be adapted for things that won't directly work in GS.

Comments

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    I guessed that you were working on joints by your wording in the other post!

    I've created a few simple bones systems in GS as well. I'm currently working on verlet integration to simulate the fluid motion of ropes, chains, and cloth. Creating a bone system seems to be only half the battle. Its difficult getting the objects to react properly to the other objects in the scene. For example, I can make simple ragdolls that act/react -- except they just fall through the floor and walls. I guess that you are experiencing the same sort of thing?

    Here is an example that consists of four joints and three sticks:
    http://www.speedyshare.com/files/30349459/IKExperiment.zip

    You can drag the different joints around and the attached parts follow. It has the rudiments of inverse kinematics.

    The brown square was there as an object for the bones react to. But so far, no dice.

    Is this similar to what you are interested in?

    RThurman
  • dotsonj23dotsonj23 Member Posts: 316
    RThurman said:
    I guessed that you were working on joints by your wording in the other post!

    I've created a few simple bones systems in GS as well. I'm currently working on verlet integration to simulate the fluid motion of ropes, chains, and cloth. Creating a bone system seems to be only half the battle. Its difficult getting the objects to react properly to the other objects in the scene. For example, I can make simple ragdolls that act/react -- except they just fall through the floor and walls. I guess that you are experiencing the same sort of thing?

    Here is an example that consists of four joints and three sticks:
    http://www.speedyshare.com/files/30349459/IKExperiment.zip

    You can drag the different joints around and the attached parts follow. It has the rudiments of inverse kinematics.

    The brown square was there as an object for the bones react to. But so far, no dice.

    Is this similar to what you are interested in?

    RThurman

    That is pretty damn cool. Much more advanced (I think, but I suck at math) than what I was working on. I don't have the problem of falling through floors (because my bones (well really just one at this point) are just bones and the body does all the collisions. My problem is getting them to react to gravity (or simulated gravity) properly.
  • dotsonj23dotsonj23 Member Posts: 316
    tshirtbooth said:
    The issue with trying to make a workaround to get joints wiring is you will need to use constrains. That is hard on the device and to many will make it crash. When joints are added to GS it will be a lot more optimized :)

    cheers

    Yep. Takes 5 contraints per bone. And probably more to get it to simulate gravity and collision. Right now about 2.5 MB of ram per bone. That is a lot. And I expect the actual joint behavior to be much much more efficient. In the meantime, however, working on this seems a fun way to learn math. I'm not in this to make money. I just love doing it, so while it may be a waste of time financially, it is fun to just figure things out and explore.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    tshirtbooth said:
    The issue with trying to make a workaround to get joints wiring is you will need to use constrains. That is hard on the device and to many will make it crash. When joints are added to GS it will be a lot more optimized :)
    Agreed -- the current version of GameSalad is not optimized (or even configured) to do do joints. Like everyone else, I have my own wish list of things for GameSalad to implement. For example, if GS just had arrays and a looping mechanism, then joints would be possible with just five or or six constrain attribute behaviors.

    Despite its current limitations, exploring what GameSalad is capable of doing is great fun! For me, GameSalad is the game!

    On a technical note, in the current version of GameSalad all the calculations needed to do a crude version of joints can be done with change attribute behaviors and a timing system. (Roughly four per joint and three per bone.) Will using change attribute (instead of constrain attribute) cut down the potential for crashing? Or will that technique just trade one set of problems for another?

    RThurman
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    dotsonj23 said:I don't have the problem of falling through floors (because my bones (well really just one at this point) are just bones and the body does all the collisions. My problem is getting them to react to gravity (or simulated gravity) properly.

    Right -- the trick to gravity will be to let GameSalad take charge of the physics. Then the joint constraints need to limit what the physics engine is not taking into account. For example, two boxes joined with a stick could just fall (using accelerate 270). But then each object will need to have its acceleration altered by the constraints of the other two objects. It is the combination of all forces (including the constant pulls of other objects) acting on an actor that needs to be taken into account. But if one is not careful, one will just end up reinventing a physics engine.

    So joints are easy! Its the physics that makes joints challenging.

    RThurman
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Another Extremely Challenging thing with making a workaround for joints is generally you will have a base actor that moves and the rest of the constrains will follow. Its very hard to make any one actor affect everything that it is joined to. for example if you have a several things hang and the are jointed together if a ball hits the top actor where the joint chain starts all of the actors below will be affected. However if the ball hits the middle of the joint chain only the actors for their down may be affected because the actor hit does not control anything above it. it is just hooked to whats above and only controls what is below because what is below it attached to it. Im sure its possible but it will be quite difficult. I personally am hoping GameSalad gets the joints right to cover that issue and will just wait for the next update.
  • hman360hman360 Member Posts: 590
    I already had something almost exactly like this! Dang, man you beat me to it. But great job. I will post mine soon.
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @tenrdrmer
    Yes, it is a challenge to get everything linked up correctly so that there is mutual influence up and down the chain of joints. In the example I posted above, I tried to address that by making each actor influenced by the one immediately above it -- and the one immediately below it. And I also gave each actor the ability to be moved by the mouse. The effect is that all actors mutually influence each other by their linkages up and down the chain.

    In principle, this should work for actor collisions. So that in a chain of five joined actors, if actor 3 has a has a bounce behavior activated, then actors 2 and 4 behave so as to maintain their relationship with actor 3. And actor 1 moves to catch up to actor 2. And actor 5 moves to catch up with actor 4.

    The above paragraph isn't as clear as I hoped it would be. But I hope it conveys some sense of how to approach this.

    All this logic (of who influences who and by how munch) will still need to be addressed whether GameSalad gets joints or if developers decide to create their own 'system of mutual influence.'

    Either way, its still fun to puzzle out the logic of it all. GameSalad is a great product for just trying to puzzle out the logic without all the hassle of code.

    RThurman
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    hman360 said:
    I already had something almost exactly like this! Dang, man you beat me to it. But great job. I will post mine soon.

    I would like to see how you are approaching this. I'm sure others are curious as well.

    I guess it just proves (for those who ask) that GameSalad does handle joints. But it will be even better if/when the update includes an official version of joints.

    RThurman
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    dotsonj23 said:
    Anyway, it's been a lot of fun. I would, however, like to work with one of the actual math gurus to make this work with gravity or at least simulate it.

    Here is an example of using gravity with a hinge joint. It is a pendulum simulation. (Actually a portrait on a wall suspended from a string.) It is initially set up to work on the mac, but if you go into the background actor, you can turn on the accelerometers and actually rotate an ios device. The portrait will still point down in any orientation.

    http://www.speedyshare.com/files/30363183/PivotingPortraitIPhone_V4.zip

    I made this back in July. And I've learned a bit since then. (But forgotten more.)

    Is this the kind of gravity work you are interested in?

    RThurman
Sign In or Register to comment.