[Behavior] Box2D+ (asm.js r2.3.0; v2.0)

  • Colludium Nice, I'm experimenting with this. It's quite different from the other physics I've used so it takes some time to get a hang if it Are you working on a physics game using this atm?

    I'm just starting one - a platform game for mobile. You could say that I built this plugin to suit my needs, so 'different' definitely reflects how my brain works! ??

    Let me know if you can think of any ways it could be improved...

  • Update to v 1.08

    • Minimum supported vertex length in Box2D+ is 2.5 pixels. The plugin will delete vertices that are shorter than 2.6 pixels (a 0.1 px buffer), or the whole fixture if it was a triangle. Avoid creating complex shapes during runtime if possible.
    • Modified the Polygon Editor example. Now includes a warning if vertices are too close together.
    • Minimum supported fixture area: 6.25. The plugin will create a 2.5 px box instead.
    • Added verbose debug option. If the above corrections occur then Verbose: true will cause such actions to be logged to console.
    • Modified the polygon separator function - minor improvement for stability.
  • Loving this behaviour so far!

    I get this if I set any collision condition like "on begin contact", on "pre-solve" etc and set the action to change any body properties like elasticity, density, mask bits, etc:

    Thank you!

  • Hi troshinsky,

    Glad you like it! This is a limitation of the engine, I am afraid. The Box2D library requires all body/fixture values to remain constant whilst the world time-step is being calculated - and these triggers occur in the middle of a world step. If I can't find a way to prevent this error from happening (ie, delay the body property change until the next tick) then I will ensure that the plugin contains info to explain this.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I see, that´s fine.

    I have another question: I really like the bouncyness of the wheel joint but it´s limited to a specified angle and I would like it to be able to bounce back into position from any angle. What I´m trying to do is, I´m attaching a dynamic body to a static body, then I want to be able to apply forces from any angle so that the dynamic body moves and rotates but then snaps back into its original position. The way the body of the car in the joints demo snaps back is really neat, I´m trying to do exactly that but without the angle limitation. I tried to make it with distance joints but didn´t get good results.

    Is there another way to do this?

    Thank you!

  • Update v 1.09

    Bug fix: Using Begin Contact, Pre-Solve or Post-Solve to change body params caused a crash because these changes were made during the World time step (not good in Box2D). The plugin now ignores any actions that take place during the World time step - Please do not try to make body changes during these collision registers. Use the End Contact trigger to make any changes after a collision (the trigger will fire after the world step and before the event sheet).

  • troshinsky - to make a wheel-like joint that is not constrained to move in one axis, you could try using distance joints. Use a few joints, set one anchor position as the wheel axle and the other to constrain the wheel's movement, each joint acts like a spring. Here's a quick demo.

  • just bought your addon for construct 3. Im struggling with impulse at angle. Can you help me by this? i want the box to go at the direction the mouse is at for example: angle(Self.X,Self.Y.Touch.X,Touch.Y). The box only starts rotating but dont go to the direction of the mouse, i dont know why?

  • Update:

    Bugfix, v 1.10

    Fix angle calculation in apply impulse at angle Action.

  • just bought your addon for construct 3. Im struggling with impulse at angle. Can you help me by this? i want the box to go at the direction the mouse is at for example: angle(Self.X,Self.Y.Touch.X,Touch.Y). The box only starts rotating but dont go to the direction of the mouse, i dont know why?

    Hi Xh3maa,

    Your problem helped me find a bug (thank you!) although the bug may not have been the cause of your problem. If you apply a force or impulse to an object and don't want it to rotate then you have 2 options:

    • Apply the force at the center of mass. The Center of Mass X and Y values are Expressions in Box2D+. If the origin is not in the center and/or the body's shape is not symmetrical about the origin then this is the only way to do this accurately.
    • Alternatively you could set the body Prevent Rotation to True, if you don't want to use the Center of Mass Expressions.
  • Update v 1.11

    Bugfix: Expression Angle of Motion

  • Update v 1.12

    Bugfix: Setting rotational velocity clamp set an incorrect value.

  • 5 stars for Plugin AND support! very good job!

  • troshinsky - to make a wheel-like joint that is not constrained to move in one axis, you could try using distance joints. Use a few joints, set one anchor position as the wheel axle and the other to constrain the wheel's movement, each joint acts like a spring. Here's a quick demo.

    Thank you so much for the example, that´s just exactly what I was trying to do!

    You´re a hero!

  • Colludium

    is it possible to set collision category&mask bits for object instances individually?

    or only object types?

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