[BEHAVIOR] Chipmunk Physics

  • can you update the example link please R0J0hound

  • can you update the example link please R0J0hound

    The link on page 1? Works for me - just tested.

  • I am positive it wasn't working before it is now though zenox98

  • Sorry, I updated it after your post and neglected to reply.

  • Hi Guys, i want to draw a line or any shape and wana to add chipmunk physics behaviour to it (with immovable property no).

    eg. if draw a line then it should fall as line with physics behaviour. Pls help for the same.

  • I'm thinking of using a potentially very large tilemap. Would the chipmunk physics work well with it? Does it parse the nearby tiles, etc?

    edit: https://chipmunk-physics.net/release/Ch ... patialHash

    found that info. I'm wondering how it applies to tilemaps, considering that tilemaps can have polygons that stretch over multiple tiles, and can get quite big.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Prominent

    It probably would I imagine. By default chipmunk uses a bounding box tree which seems to work well. That spacial hash in that link isn't implimented in the js library used.

    vikash2k2jsr

    There are some discussions about that elsewhere, but best as I understand you may be able to use the polygon plugin to create the arbitrary shape. I've never tried it so I could be mistaken.

  • thanks for reply. if i use polygon plugin and draw object. will i be able to apply chipmunk physics behaviour to it ?

  • vikash2k2jsr

    Probably, that's why I mentioned it. I don't think I have the time to install that plugin and try it though.

  • Hi R0J0hound

    I tried a little pool / snooker test with both the normal physics and Chipmunk. I set it up so that there are aiming lines to show where the ball goes. My trouble is that on collisions (In both physics) the ball moves different to the direction expected.

    My aim line draws a strait line through the center of the white ball and red ball to show the direction it should take on impact. It works when a shot is strait but the greater the angle of the shot, the further away from this line the red ball takes. I noticed that removing friction and playing with elasticity helps but no settings I have found get it working correct.

    Do you know if its a limitation of the physics?

    Thanks,

  • 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.

  • 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.

  • 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.

  • 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?

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)