What is wrong with the physics? Body does not match image

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I have had this problem a number of times where the "shape" of the "body" of an objects physics does not match the image, even when I have it set to be the shape of the first image. I have uploaded an example where I have an object that is supposed to be shaped like an acorn, but the physics object is not matching the actual image but is off somehow. It looks a little bit to me like the physics body is the actual image upside down, but could be wrong about that ? Do anyone know how to fix this and what is wrong?

    (You can spawn acorns by pressing the right mouse button)

  • I remember reading about this issue somewhere else. The answer was that Box 2d is not able to match concave shapes properly. If you look, the buggy collision happens exactly at the concave side, while the convex parts of the acorn work pretty well.
    Think it's a limitation with no real workaround besides making the colliding shape smaller than the displayed object and accept a slight overlap working around the "gap" issue.

    Please login to see this link.
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • I remember reading about this issue somewhere else. The answer was that Box 2d is not able to match concave shapes properly. If you look, the buggy collision happens exactly at the concave side, while the convex parts of the acorn work pretty well.
    Think it's a limitation with no real workaround besides making the colliding shape smaller than the displayed object and accept a slight overlap working around the "gap" issue.

    Hmm I have tried to modify the first frame a bit but could not get anything that looked convincing, is it possible to display the actual physics bodies somehow?

    Read the help file it explains how it works

    Did not find anything about this in the help file?

    Steam games: Please login to see this link.

  • Help file keywords > Movements, Physics, Shapes and Collisions

    "Shapes and collisions

    A crucial part of a physical engine is collisions. The engine must detect when two objects collide with each-other, and take appropriate actions, like stopping the objects or pushing one onto another.
    Box2D performs collisions based on shapes. A shape being the form of an object in the world. The shape must be set during initialization, that is, in a Clickteam Fusion 2.5 application, at start of frame, or when the object is created. Box2D works with only one shape for an object : it does not accept very well that the shape of an object is changed in the middle of the game. Clickteam Fusion 2.5 therefore defines the shape of the object in the physical word as soon as the object is created.
    Most of the different movements allow you to choose between 3 different shapes for your objects:

    Box
    The shape of the object is a simple box. The dimensions of the box are the dimensions of the first image of the object. You may need to use this shape if you want an object to be perfectly balanced on each side of its center of gravity : using a shape constructed by Clickteam Fusion 2.5 may not produce a completely symetrical shape.
    Circle
    The shape of the object is a circle. The radius of the circle is calculated from the width and height of the first image (by using the average between the two values). Circle shape will allow your object to roll perfectly on the ground.
    Shape of first image
    With this option, Clickteam Fusion 2.5 analyses the shape of the first image of the object, and converts it into a shape that can be understood by Box2D. To avoid slowing down the engine, the number of points defining this shape is limited to 8, so the shape created is a rough estimation of the shape of the object."


    More info in the help file..


  • Ok I found that part, it did not really describe the problem though or how to overcome it, apart from that the shape is made of 8 points so it is not exact.

    Steam games: Please login to see this link.

    Edited once, last by Outcast (May 29, 2020 at 12:06 PM).

  • Hmm I have tried to modify the first frame a bit but could not get anything that looked convincing, is it possible to display the actual physics bodies somehow?

    Nope :/ I’ve also not found a way to handle concave shapes myself.

    Please login to see this link.
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • I think I got the best result by just moving the hotspot a bit up on the object. It is not perfect, but it looks alright now I think. It would be hugely helpful if it was actually possible to draw the actual physics bodies on top of the object somehow to show how the actual physics bodies are vs the graphics objects and even be able to toggle between them. It is a bit now like trying to adjust something blind

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!