[BEHAVIOR] Chipmunk Physics

Post your completed addons to share with the community

Post » Mon May 08, 2017 5:43 am

@Mayfly
The way you're calculating the expected direction could be off. Also increasing the simulation iterations could improve it.
I've gotten a close before, but not completely exact which I attributed to the collision time being approximate.
Unfortunately the capx is very wip and is left in incomplete state. Also it's a chunk of math to calculate the collision time and the result of a collision which I am no longer familiar with.

https://www.dropbox.com/s/yz18begzbo294 ... .capx?dl=0
Also here is some reading on the math it was based on:
http://www.real-world-physics-problems. ... iards.html

I just realized the capx uses the built in physics and not chipmunk if that matters. It's from an old attempt at the problem and I probably won't have the time to refine it. Basically it would be perfect if we replicated the physics simulation and advanced the simulation to see the path.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Mon May 08, 2017 6:43 pm

@R0J0hound

Thanks for a quick reply. The version I was putting together must have been from an old example I found of yours on the forum. I then did a version in both Chipmunk and built in physics but it behaves the same in both. I added the aim line to your latest version and it gives the same result. I am calculating the aim by putting a ray at the 'hit' ball and angle towards the aimed ball.

Image
B
38
S
11
G
1
Posts: 199
Reputation: 4,465

Post » Tue May 09, 2017 6:38 am

@mayfly
The difference could be a lot of things. I have no definitive answer because I haven't taken the time to break it down and test it further.

The prediction is based on an exact collision point, but the physics behaviors never collide at that exact point. Typically the collision occurs after the shapes are overlapping. So the objects are pushed apart first and then the collision point is used, but that likely is a bit off. There are a bunch of other little things such as the pushing out could be over several frames and there may be a tolerance to allow a little overlap.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Tue May 09, 2017 9:41 pm

@Ashley Do you know if there is a way to try to alter the physics to help improve this to make a pool game feasible?
B
38
S
11
G
1
Posts: 199
Reputation: 4,465

Post » Wed May 31, 2017 12:15 am

I'm attempting to make a test scene similar to a pinball plunger, where you can drag a box downwards, and when you let go it springs up. I've got that working with a spring joint. And i've made a box that has a groove joint to hopefully keep the plunger stuck within the area of the box height, but i'm still able to pull the plunger out of the track its supposed to sit in.

Is there any way i can limit the plunger to stay inside its track while pulling it and letting to?

see attached capx

https://www.dropbox.com/s/wjwfj8vwbwi4f ... .capx?dl=1
B
83
S
40
G
15
Posts: 987
Reputation: 16,847

Post » Sun Jun 04, 2017 10:05 pm

@justifun
Use a spring joint instead of a pivot
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Mon Jun 05, 2017 5:58 am

@R0j0hound - its getting closer. but when the click is initated the square wiggles all around till it settles. is there a way i can prevent that?

thx
B
83
S
40
G
15
Posts: 987
Reputation: 16,847

Post » Mon Jun 05, 2017 9:07 pm

@justifun
It only wiggles a tiny bit for me. Did you set the rest length to 0?
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

Post » Fri Jul 14, 2017 5:01 pm

hey Rojo, cool plugin.. but most likely I'm using it all wrong...

first, I can't figure a way to apply an impulse or force at the angle my shooter is facing (so I just did a random angle)

but how come when the ball bounces off the top it always comes back straight? Opposed to when I left-click and drag/release it, it does the angles correctly?

https://www.dropbox.com/s/omqseqg848gjq ... .capx?dl=0
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Mon Jul 17, 2017 4:10 pm

@jobel
There's a dropdown to select between rect and polar. Select polar and set the angle to shooter.angle and dist to 500.

For the bouncing adjust the friction. High friction absorbs perpendicular motion on a bounce.
B
91
S
31
G
103
Posts: 5,235
Reputation: 67,756

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: Demkamen and 3 guests