[SOLVED] Chipmunk Physics: Bounce off object

Get help using Construct 2

Post » Thu Nov 03, 2016 5:54 pm

So, I'm still challenging my (non-existant) math skills with a pool game.

Currently, I'm having issues with bouncing the balls off the pool table edges.
I'm using the Chipmunk physics plugin by @R0j0hound, so you probably have to be quite familiar with that to help me.

(I tried using bullet behaviour for the balls with "bounce" enabled, doesn't work, since bullets don't bounce off bullets)
(I tried using the normal physics, that misses features that I need, like kinetic energy on impact)
(I tried using chipmunk for impact expressions and bullet behaviour for bouncing off, doesn't work since bullets still don't bounce off each other and bullet & chipmunk don't work together anyways)

So what I need is an action that I can use to bounce a ball off another object manually.

Currently, I have this
Image
after a "On post collide" event.
That setup is probably total bullsh*t, but this is my first time using CM physics and I am in no way appropriately familiar with the plugin to figure the out the correct parameters.
(Believe me, I spent hours trying out setups and constellations of parameters)

Any help is appreciated, thank you.
Last edited by randomly on Fri Nov 04, 2016 7:01 pm, edited 1 time in total.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Nov 03, 2016 8:29 pm

The bouncing should be handled by the behavior itself. Just give the objects the chipmunk behavior and make the edges have the immovable property. Setup should be identical to the built in physics behavior.
To make everything bounce like pool balls, set the elasticity to 1 on everything. The apply impulse action is only needed to initially launch a ball. No math is needed.

You can calculate the KE of a collision with the physics behavior with a little math, but that's mainly just useful to adjust the volume of the hit sounds.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Fri Nov 04, 2016 7:01 pm

Ahh... elasticity to 1 for every object..
How could I overlook that. Sometimes it's the small things that make a difference.

(And yeah, I tried to use the Apply impulse action to simulate bouncing off, not for anything silly :) )


Thanks for your help.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Dec 26, 2016 9:07 am

@randomly or @r0j0hound , any idea why is the CM physics has the jerking in movement at low speed? im experiencing some weird "shakings" i bet its from stepping however if i decrease the stepping mode everything falls apart. since accuracy detection wont be handled with precision anymore. Any tips?
B
75
S
22
G
68
Posts: 1,337
Reputation: 43,271

Post » Mon Dec 26, 2016 6:55 pm

Just guess but by default the stepping mode is fixed which means the timestep will be the same for every frame. So if the actual dt varies a lot frame to frame you'll get that jerking. You can change the stepping mode to variable which should help eliminate that.

If it doesn't help then I'd guess an object with the bullet behavior moving at the same speed will have similar jerking. It's something that has come up before, and it's caused by how the browser used deals with your current hardware.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, marcinkowski, tarek2 and 17 guests