[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Fri May 15, 2015 2:52 pm

@R0j0hound
Thanks for the heads up R0jo, I guess that happens to all of us sometimes. I could do an "ugly" solution just by pinning impressions over the sprites but then I would need to have a pinned sprite on top of each body part of the ragdoll to later show damaged body parts for example (so it's not really that good option...) Being also a bit of a perfectionist in optimizing things to the extreme, I wouldn't be satisfied by makeshift solution that would clutter things unnecessarily...

so I'll continue looking into the source, and if I make any progress pinpointing a possible solution I'll post here... luckily the commenting is very good (I'm really impressed with your work... I even was able to get rather good performance on the first iPad when using Chipmunk physics).

@GameThirsty

Just like R0j0 said, it's best to recreate control logic with chipmunk..if you're mixing several behaviors together, you sooner or later will face situation where the logics are clashing... if you're making a car game, you could make acceleration by tweening a value towards certain velocity, for example) - I would recommend at least completely rethinking what things you need for the game, and defining them.. then think how to do them with chipmunk (it's very diverse).
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Wed May 20, 2015 1:42 pm

This plugin is quite amazing and so far it has delivered a far better experience for my game than Box2D has done.
1 thing that I think could be implemented though is:
Condition: Compary Velocity
Condition: Compare Velocity X
Condition: Compare Velocity Y
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
24
S
10
G
7
Posts: 253
Reputation: 4,921

Post » Wed May 20, 2015 6:41 pm

@SgtConti what do you mean by those conditions?
If I understood correctly, I think what you're asking for is already in there. You can put that kind of a condition through System: Compare two values.. and then typing YOURSPRITE.Chipmunk.VelocityX / VelocityY.
B
14
S
3
G
1
Posts: 77
Reputation: 1,035

Post » Fri May 22, 2015 12:18 pm

I know, but if you have multiple instances, and you need to pick one specific having that specific velocity, that could be a problem.
At least I dont know how to do it.

//Edit: I found the system condition to compare the values while picking an instance. The manual is alway helpful, even after 500+ hours of Construct 2 use :D
"It's done when it's done"

Shadows of War
Buy on Steam ;)
B
24
S
10
G
7
Posts: 253
Reputation: 4,921


Post » Sat Jun 20, 2015 10:13 pm

Found a bug (edit: okay nevermind it isn't a bug):
http://www.filedropper.com/hittinglinebug
The sprites falling should all turn green, but only one does (because it overlaps the corner??).
I want to query first hitting line for all the falling objects to know when another object is beneath them. Seems as if this doesn't work as expected.

edit: on further analysis, it appears that it only triggers when the line is entering the object. It doesn't trigger if the line begins within the object.
Is there a way to check if a point resides within an object? , then I could use that along with the line check.

edit2: okay I found a way to solve it. I used two more short lines pointing down at the corners.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sun Jun 21, 2015 5:48 pm

Is there a way to find the nearest corner of an object? I know there is the nearest point on object event, but that can return points that are between corners. I need a way to get the position of nearest corner/vertex.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sun Jun 21, 2015 6:28 pm

@Prominent
The best way I can think of would be to create an object at each corner and use the "pick nearest" condition. You'll probably need to define the corners with imagepoints to do that.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Sun Jun 21, 2015 6:38 pm

@R0j0hound , ah yea I suppose I could do it that way. I was hoping for something simpler since the objects already have verts to create the shapes. There's no way to access that without editing the plugin or writing my own. I was looking through the runtime and it was a bit confusing, and don't feel like messing with it..
The sprite already has ability to get x,y of the imagepoints, so I could create imagepoints at every corner and cycle through them checking the distances to find the nearest one, but it gets difficult to manage if objects have different numbers of imagepoints and imagepoints that shouldn't be checked- just thought I'd ask in-case there was something I was overlooking.
Maybe I'll look at the runtime again and see if I can make sense of it.
Last edited by Prominent on Sun Jun 21, 2015 7:31 pm, edited 1 time in total.
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

Post » Sun Jun 21, 2015 6:40 pm

Or maybe I'll try making my own behavior that checks the polygon in sprites..
Do you know where that data is kept?
B
41
S
19
G
65
Posts: 1,085
Reputation: 37,842

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests