Freeze the object ?

Discussion and feedback on Construct 2

Post » Thu Dec 03, 2015 10:30 am

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 ! ;)
B
15
S
4
Posts: 86
Reputation: 1,480

Post » Thu Dec 03, 2015 12:03 pm

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.
B
91
S
31
G
98
Posts: 5,192
Reputation: 65,170

Post » Thu Dec 03, 2015 3:52 pm

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 !

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 !
B
15
S
4
Posts: 86
Reputation: 1,480


Return to Construct 2 General

Who is online

Users browsing this forum: tumira and 2 guests