Freeze the object ?

0 favourites
  • 3 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Greetings fellow Constructors !

    I just finished my own drag & drop system because the one included in C2 isn't really receptive with any physical behavior (as far as I know, at least). I worked with Chipmunk plugin to be able to use better joins. Everything is functional, I get the results I wanted. Still, I have to stabilize one or two things, especially...a collision issue. Original, huh ?

    So, as I said, it's a drag & drop system. Everything is under Chipmunk physic, my system uses its joints (it's basically a pivot joint between the cursor and the imagepoint X of the cube). We have a cube on the ground, the user can drag and throw the cube away with the cursor without restriction. BUT. If I use revolute join with usual physic, everything is ok. However, with Chipmunk...I can "force" the draged object IN the ground or the walls or any immovable sprite.

    As you may understand, it should stop ! The cube should stay stuck against the surface and that's it. Absolutely not pass through it with a very odd behavior. I wonder if you guys have any suggestion to fix this problem. I'm working on some events supposed to destroy the pivot joint when the object is overlapping another one...but for now, "overlapping" includes "on the ground" so my drag & drop system doesn't even work anymore because we can't drag the cube as it's placed on the ground...

    Any help/advices will be appreciated !

  • I've found a spring works better than a pivot joint in situations where you want to drag the object around. I think I had a example in the first few pages of the plugin.

    Other things you could try:

    *set a max force for the joint. By default a force up to infinity can be exerted on the objects to make the joints match. By setting it lower it would make the joint more relaxed and keep it from pulling into another object.

    *increase the iterations of the simulation. This is a performance trade off. The higher the iterations the simulation will get closer to converging on a perfect solution. Personally I never mess with it, instead I do other things like above.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to see an answer from you, r0j0hound. First of all, I knew your example (something about Newton and stuff) because I had watched the whole topic after the download of the plugin. Very instructive, and I tried to use a spring too, but finally it appears that I prefer the "aerial" movements and rotations of the cube when using a pivot. Thanks for the suggestion thought !

    [quote:12xsepse]set a max force for the joint. By default a force up to infinity can be exerted on the objects to make the joints match. By setting it lower it would make the joint more relaxed and keep it from pulling into another object.

    Good idea, and it works perfectly. By the way, you did a very great work on this plugin, the beast is really useful and powerful. Once again, thank you, for the help, and for your work !

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