[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Fri May 08, 2015 8:57 pm

@R0J0hound
Thanks for the info, and your time.

In the capx I provided above, you can see that I've already added a gear and pivot joint to the Base and Pivot sprites, and a touch event for the Slide sprite. What I am lacking in are examples or documentation of the type of mechanism I'm trying to build. Mine is ridiculously inadequate. I contacted support hoping they could direct me to such examples or documentation, and was told: "it's absolutely unclear what exactly you are trying to achieve". So it's very likely that I have been too vague with my descriptions. To help clarify, I made a short video covering the functionality I am hoping to achieve.

Please know that I am not asking for anyone to do the hard work for me, I am only asking for working examples and/or documentation that could possibly aid in my efforts to build what appears to be a one-of-a-kind Consturct2 compound structure.

Here is the video: https://youtu.be/jaLWHBlhSmQ
B
5
Posts: 12
Reputation: 249

Post » Fri May 08, 2015 9:59 pm

@WebMagi
I can't think of any examples off hand, but a search for "angry birds" on the forum will give examples of a slingshot which is similar.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Fri May 08, 2015 11:26 pm

@R0J0hound

Sure, the "Template-PhysicsCatapult.capx" that comes with Construct 2 is a knockoff of angry birds. And originally I started with that template, but their whole approach does not seem conducive to what I'm trying to build. I've opened and reviewed hundreds of capx files, but so far I'm not finding a lever attached to a pivot, which acts like a tension spring when pulled backwards. Actually, the hardest thing seems to be creating a lever attached to a pivot, which slides along the top (and acts like a tension spring when pulled backwards), while also being able to pull up or push down on the pivot at every point along its entire length. So this has never been done?

I've searched the forum for catapult, which is closer to my contraption than a slingshot, but I have not come across the right combination of examples.

Your Chipmunk2D addon seems to offer greater flexibility than the default Construct2 physics, and the Joints demo: https://dl.dropboxusercontent.com/u/2494815/demo/Joints.html looks like the right place to start. So there are no examples of these joints being used in Construct 2?

My apologies for being such a pain.
B
5
Posts: 12
Reputation: 249

Post » Sat May 09, 2015 6:24 pm

@WebMagi
It's just a matter of using joints to link it together. Then to manipulate it with just physics you can use a dummy object that's moved by the mouse that you connect and disconnect from objects. Here's an example of a possible way to set it up.
https://dl.dropboxusercontent.com/u/542 ... aunch.capx
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

Post » Sat May 09, 2015 7:11 pm

@R0J0hound

You are absolutely brilliant! This example should come standard with Construct 2. I'm assuming I can use a Touch object in place of the Mouse object? Freaking awesome!!! :D
B
5
Posts: 12
Reputation: 249

Post » Sun May 10, 2015 12:47 am

I'm getting the following error:

Code: Select all
Javascript error!
Error: Assertion failed: Internal Error: Attempting to set body's angle to NaN
http://localhost:50000/rojoChipmunkBeta_behavior.js, line 52 (col 8)


It appears to be related to the 4th action: "gear joint to keep the angle of the plunger the same as the lever". When I toggle it disabled, the error goes away. Could my polygon collision shapes be causing an issue with the 0 phase setting?
B
5
Posts: 12
Reputation: 249

Post » Sun May 10, 2015 1:14 am

Never mind. I had the lever (plunger) "Prevent rotation" set to yes. ;)
B
5
Posts: 12
Reputation: 249

Post » Mon May 11, 2015 5:06 pm

Any progress with that parent of 'undefined' error @R0j0hound ?

If necessary, I can try creating an environment where the bug occurs more consistently whenever a collision happens.
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Wed May 13, 2015 8:31 pm

@R0J0hound

I am deeply enjoying your physics behavior. Thank you!

I got an issue though. When I am colliding two sprites with the behavior, the one that I control, actually goes into the other sprite. It seems like it doesn't stop at the sprites collision box. Is there a way around this?

I am using the car behavior on sprite 1. Sprite 1 is being ran into sprite 2, sprite 1 goes inside sprite 2 making it appear unrealistic.


Thank you!
B
17
S
6
Posts: 348
Reputation: 2,608

Post » Fri May 15, 2015 2:44 am

@striimix
Sorry I haven't had a chance to look yet. I've been in a programming slump.

@gamethirsty
It doesn't really play well with other behaviors. To make it respond realisticly you need to move the object with only the chipmunk behavior.
B
92
S
32
G
106
Posts: 5,273
Reputation: 69,457

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests