[BEHAVIOR] Chipmunk Physics

  • statham

    I purposely didn't add and conditions to compare expressions of the behavior. You should use system-> compare or pick by comparison with the expression to do it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I wanted to make an object with physical and when stopped, would make an animation

  • statham

    You can still do that as I said.

    Add a new condition:

    System -> pick by comparison

    Select you Sprite as an object type and use the expression Sprite.chipmunk.speed to get the speed.

  • R0J0hound , I found an issue with the ignore collision stuff.

    If physics object uses collision polygon, and sprite is animated, then it won't ignore a collision in cases where you just want to collide when jumping ontop of it. For some reason when a frame changes(even if polygon remains same shape), it collides each time I think, which ends up make it seem like you collide from the top even though you aren't.

    Here's a capx: https://1drv.ms/u/s!AhHSZHEulqh_gXKKkewSu_0hXMDg

    Any idea on how to get around it? or is this just a limitation we have to deal with?

  • Prominent

    I can't open your capx right now but when the animation frame is changed the collision shape is recreated. The only way for it to know if the collision polygons of two different frames are the same is to compare all the points, which may be slower than just recreating it. Also note changing size also causes the collision shape to recreated as well.

    So to the physics engine it's a new shape, so it causes a new collision. I guess a workaround in the plugin would be to modify the collision shape instead of recreating it, but there are many caveats with that, and that's something that's absent from the chipmunk documentation so it's not really something it was designed to do.

    Anyways the solution is to not change the frame on physics objects. If you want to change appearance, use a seperate object.

  • thanks for the info- makes sense. I'll use a separate object.

  • R0J0hound

    Hi, thank you for this powerfull tool!

    I have impluse at angle with box2d Physic working perfectly on my game. Calculate on a distance between the ball and my charactere (like Angry Bird but at 360°)

    I tried to apply impulse at angle with Chipmunk but i can not find how to make it.

    I don't understand where i'am wrong... any idea ?

    Images:

    https://www.dropbox.com/s/r718iqysbfqif4y/1.jpg?dl=0

    https://www.dropbox.com/s/zb9h6osbguhfphn/3.jpg?dl=0

    https://www.dropbox.com/s/yxpvze70ymzmawv/2.jpg?dl=0

  • SuperSushi

    In you second image change the top "rect" to "polar"

    Rect lets you give a X and y impulse

    And polar lets you set an angle and direction like the physics action you used in the first image.

  • R0J0hound

    Yes, that's it !

    Thanks a lot

  • hi thx for this plugin, but can you tell me how I make simple orbit in this plugin? im try to do it with polar orbit but its confusing to place the numbers

    how to calculate it for orbit around one other object from other object?

  • BereLaDD33

    First set gravity to zero. Then you can google two formulas.

    The first is "universal gravitation". It's a formula for calculating the force between two objects. Basically every tick you'd apply the force calculated by that equation toward another object.

    The "G" value you'd tweak to be more of the scale that fits onscreen. You may also tweak the object masses.

    The second formula is "orbit velocity". Basically take the angle from the moon to the earth, add or subtract 90, and set the velocity of the moon in that direction with the result of the formula.

  • R0J0hound First of all, this is looking really great. Thanks for all the effort you've put into making and maintaining this.

    I'm trying to convert a normal Physics game to Chipmunk, and replaced all functions with what I think are exact Chipmunk equivalents. The objects move at vastly different speeds, so I am wondering if the Velocity values are represented differently. Is there a simple way to convert the values? I have a hunch it's by a factor of 60 due to dt stuff but I figured you would know better.

  • ryguydavis

    By default the timestep for chipmunk is set at 1/30, so at 60fps the speed will be double. You can change the timestep to 1/60 for the speeds to be the same.

  • R0J0hound Wow that's much simpler than I expected. Thanks a lot.

  • Okay, so can you tell me bluntly; are Chipmunk Physics superior to the vanilla C2 physics? &&&&

    ?? ?? ?? ?? ?? ?? ?? ???? ???? ???? ???? ??

    HAPPY NEW YEARS !!!

    ?? ???? ???? ???? ???? ?? ?? ?? ?? ?? ?? ??

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