2D physics engine for games

LiquidFun logo

LiquidFun Version 1.1.0

Welcome to LiquidFun!

LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see some examples.

LiquidFun is an extension of Box2D. It adds a particle based fluid and soft body simulation to the rigid body functionality of Box2D. LiquidFun can be built for many different systems, including Android, iOS, Windows, OS X, Linux, and JavaScript. Please see Box2D/Documentation/Building/ for details.

Discuss LiquidFun with other developers and users on the LiquidFun Google Group. File issues on the LiquidFun Issues Tracker or post your questions to stackoverflow.com with a mention of liquidfun.

Please see Box2D/Documentation/Building/ to learn how to build LiquidFun and run the testbed.

LiquidFun has a logo that you can use, in your splash screens or documentation, for example. Please see the Programmer's Guide for the graphics and further details.

For applications on Google Play that integrate this tool, usage is tracked. This tracking is done automatically using the embedded version string (b2_liquidFunVersionString), and helps us continue to optimize it. Aside from consuming a few extra bytes in your application binary, it shouldn't affect your application at all. We use this information to let us know if LiquidFun is useful and if we should continue to invest in it. Since this is open source, you are free to remove the version string but we would appreciate if you would leave it in.

Comments
  • Segmentation fault when running Convex Hull

    Segmentation fault when running Convex Hull

    Hi,

    I installed Liquid Fun v1.0 (stable) with DEBUG build type mentioned here. However, after executing the Testbed, the program throws segmentation fault whenever I select Convex Hull test from the menu.

  • lfjs: support b2Contact.SetEnabled and fix b2WorldManifold.GetPoint

    lfjs: support b2Contact.SetEnabled and fix b2WorldManifold.GetPoint

    for javascript version.

    1. add support for b2Contact.SetEnabled and b2Contact.IsEnabled

    2. b2WorldManifold.GetPoint, each point data position interval should be 8 instead of 2

  • liquidfun.js bugs

    liquidfun.js bugs

    I found some problems with the existing bindings.

    b2Body.CreateFixtureFrom(Def|Shape) accesses a global variable called world instead of the world the b2Body belongs to.

    The methods GetParticleCount/GetPositionBuffer don't work quite right. Sometimes GetParticleCount is off by one, which might be because of the int/double casting. The position buffer is too small. It has the same size as the numberGetParticleCount() returns, but should be twice as large. The current bindings code seems to allocate the buffers correctly, but still results in this problem while running the code. Unfortunately, I'm not so acquainted with Emscripten so I can't figure out where the problem lies.

  • Update CMakeLists.txt to successfully build Xcode project from cmake -G Xcode

    Update CMakeLists.txt to successfully build Xcode project from cmake -G Xcode

    This wasn't compiling properly. I had originally opened https://github.com/google/liquidfun/issues/37 but then closed it as I wasn't too sure if the project was being kept up to date. Anyways, someone commented on issue 37, so creating a pull request for the fix.

  • OSX build results in blank white screen when running Testbed

    OSX build results in blank white screen when running Testbed

    So this is sort of a combo problem. First issue is that using

    cmake -G Xcode

    A proper Xcode project file does not build. There are a slew of errors. They range from TryCompile issues to get_filename_component called with incorrect number of arguments. If you try running cmake -G Xcode a few times, it eventually churns out an Xcode project file, which does build. However, when running 64-bit, it produces a white screen only. In 32-bit, you see the graphics, but the simulators do not run and it seems to have no keyboard input.

    Alternatively, I tried to build it using build.sh. This worked. But the result was the same: Testbed ran with a pure white screen.

    I'm running OSX 10.9.5. I installed XQuartz 2.7.7. My cmake version is 2.8.12.1. I am however, using Xcode 6.1. I should also note that the iOS version runs fine.

  • Cannot build on windows without commenting out line 154+ in CMakeLists.txt

    Cannot build on windows without commenting out line 154+ in CMakeLists.txt

    When pthread.h is not available (didn't test with an available one), the build fails with:

    CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: Threads::Threads

  • Remove sdk after $ANDROID_SDK_HOME

    Remove sdk after $ANDROID_SDK_HOME

    $ANDROID_SDK_HOME should point to SDK home directory, not a directory above with hardcoded sdk directory.

    Trying to build Testbed with build_apk.sh fails due to wrong path under Linux, since SDK unpacks to android-sdk-linux.

  • Compacting list is a big problem

    Compacting list is a big problem

    We're running physics at a fixed rate and interpolating motion between the last two physics steps. For this reason we need the current and previous position of a particle, but the self-compacting list feature causes the particle indexes to become invalid. How can we persistently track a single particle?

  • Based on SPH ?

    Based on SPH ?

    I have a question, is liquidfun based on some form of SPH ? After looking at source code it doesn't seem so. Is there any paper I can read about algorithms being used ?

  • Particles collide with second fixture at shared vertex

    Particles collide with second fixture at shared vertex

    When particles move along a fixture and one of the vertices is shared with another fixture, the particles then behave as if they collide with the second fixture.

    particle vertex collision

    Here's the example in full:

    liquidfun_particle_bug.zip

  • Finished JS bindings for basic collision filtering

    Finished JS bindings for basic collision filtering

    This adds JavaScript bindings for b2Fixture.Refilter, and a JavaScript version of b2Fixture.SetFilterData. It also makes b2Body set the fixture's filter from the fixtureDef.

  • Unable to build on Debian SID

    Unable to build on Debian SID

    I applied the patch from issue 110 but now get the below error...

    [ 21%] Building CXX object Box2D/CMakeFiles/Box2D.dir/Collision/b2DynamicTree.cpp.o /home/rcook/data/downloads/debian/liquidfun-1.1.0/liquidfun/Box2D/Box2D/Collision/b2DynamicTree.cpp: In constructor ‘b2DynamicTree::b2DynamicTree()’: /home/rcook/data/downloads/debian/liquidfun-1.1.0/liquidfun/Box2D/Box2D/Collision/b2DynamicTree.cpp:31:15: error: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct b2TreeNode’; use assignment or value-initialization instead [-Werror=class-memaccess] 31 | memset(m_nodes, 0, m_nodeCapacity * sizeof(b2TreeNode)); | ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /home/rcook/data/downloads/debian/liquidfun-1.1.0/liquidfun/Box2D/Box2D/Collision/b2DynamicTree.cpp:20: /home/rcook/data/downloads/debian/liquidfun-1.1.0/liquidfun/Box2D/Box2D/../Box2D/Collision/b2DynamicTree.h:28:8: note: ‘struct b2TreeNode’ declared here 28 | struct b2TreeNode | ^~~~~~~~~~ cc1plus: all warnings being treated as errors make[2]: *** [Box2D/CMakeFiles/Box2D.dir/build.make:720: Box2D/CMakeFiles/Box2D.dir/Collision/b2DynamicTree.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:234: Box2D/CMakeFiles/Box2D.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

  • Fix YouTube video embeds in documentation

    Fix YouTube video embeds in documentation

    The examples at https://google.github.io/liquidfun/#Examples do not load currently, because as the console reports:

    Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure frame '<URL>'.
    This request has been blocked; the content must be served over HTTPS.
    
  • Major fixes

    Major fixes

    • Several major fixes to BeginContact and EndContact
    • Makes fixture<->particle collision distance use radius instead of diameter, and if the extra distance was intentional, the setting b2_fixtureParticleCollisionRadiusScaler gives control over this instead of it being a constant 2.
    • Makes b2ParticleSystem forces clear in b2World::ClearForces(), the same way that b2Body forces are cleared. This fixes forces from being applied at only the first particleIteration.
    • SolveCollision and SolveBarrier relied on (delayed) forces to be cleared immediately, in order to generate the contacts they desire, so I added m_impulseBuffer for them to use, which clears immediately.
    • Fixes elastic directional bias. I believe that this bias was more noticeable with smaller time steps.
  • Can't build liquidfun on Ubuntu.

    Can't build liquidfun on Ubuntu.

    Hello everyone,

    following the procedure described in the https://google.github.io/liquidfun/Building/html/md__building_linux.html page, cd liquidfun/Box2D cmake -G'Unix Makefiles' make

    i get many errors, as follow:

    This warning is for project developers. Use -Wno-dev to suppress it.

    CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::X11

    CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::ICE

    CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::SM

    CMake Error at CMakeLists.txt:158 (set_target_properties): set_target_properties Can not find target to add properties to: X11::Xau

    How can i fix and complete the build?

    Thank you very much

Related tags
2D physics engine for games

LiquidFun Version 1.1.0 Welcome to LiquidFun! LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see s

Jan 5, 2023
A fast and lightweight 2D game physics library.
A fast and lightweight 2D game physics library.

NEW IN CHIPMUNK 7 Chipmunk 7 is complete and now includes the ARM NEON optimizations, the autogeometry code, and the mulithreaded solver. The latest p

Dec 30, 2022
C++ library for multi-physics simulation

Project CHRONO Project Chrono represents a community effort aimed at producing a physics-based modelling and simulation infrastructure based on a plat

Jan 6, 2023
High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.
High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.

Simbody Simbody is a high-performance, open-source toolkit for science- and engineering-quality simulation of articulated mechanisms, including biomec

Dec 25, 2022
Real-time multi-physics simulation with an emphasis on medical simulation.
Real-time multi-physics simulation with an emphasis on medical simulation.

Introduction SOFA is an open source framework primarily targeted at real-time simulation, with an emphasis on medical simulation. It is mainly intende

Dec 22, 2022
Natively multithreaded physics for threejs with PhysX.

Three-Physx Natively multithreaded physics for threejs with PhysX and an easy interface. Credit to Milkshake inc, physx-js, three-ammo, three-to-canno

Jun 6, 2022
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Jan 7, 2023
Box2D is a 2D physics engine for games

Build Status Box2D Box2D is a 2D physics engine for games. Contributing Please do not submit pull requests with new features or core library changes.

Jan 7, 2023
2D physics engine for games

LiquidFun Version 1.1.0 Welcome to LiquidFun! LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see s

Jan 5, 2023
Bounce is a 3D physics engine for games.

Bounce Welcome! Bounce is a 3D physics engine for games. Features Common Efficient data structures with no use of STL Fast memory allocators Built-in

Aug 3, 2022
Box2D is a 2D physics engine for games

Build Status Box2D Box2D is a 2D physics engine for games. Contributing Please do not submit pull requests with new features or core library changes.

Jan 9, 2023
Real-time oriented physics engine and library that's currently best suited for 2D games.

PlayRho A way to play with physical behaviors like the conservation of momentum. PlayRho is a real-time oriented physics engine and library that's cur

Nov 25, 2022
Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.
Defold Engine integration with Yandex.Metrica to track your games on Yandex.Games.

Yandex.Metrica for Defold Yandex.Metrica is a free of charge web analytics tool for websites, that's the reason why we can use it for HTML5 games. Yan

Nov 26, 2022
A multi core friendly rigid body physics and collision detection library suitable for games and VR applications.
A multi core friendly rigid body physics and collision detection library suitable for games and VR applications.

Jolt Physics Library A multi core friendly rigid body physics and collision detection library suitable for games and VR applications. A YouTube video

Dec 31, 2022
A multi core friendly rigid body physics and collision detection library suitable for games and VR applications.
A multi core friendly rigid body physics and collision detection library suitable for games and VR applications.

A multi core friendly rigid body physics and collision detection library suitable for games and VR applications.

Jan 4, 2023
This repository is about a school project about games with physics, written in C++.
This repository is about a school project about games with physics, written in C++.

Eight Ball Pool ?? A game about playing physics-based eight ball pool. ?? Table of Contents About Getting Started Usage Built Using About the creators

Sep 3, 2022
This is a list of different open-source video games and commercial video games open-source remakes.

This is a list of different open-source video games and commercial video games open-source remakes.

Jan 2, 2023
Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE.

Tactile-Arcade-Games - Wrote a C program comprised of four separate games that run in a loop using the PSoC 5LP board and Cypress IDE. Used two potentiometers, two ADCs to convert their voltages to digital values, a PWM to drive two servos, an 8x8 RGB LED matrix, 40 digital output pins and 8 power MOSFETS to control the matrix, and a character LCD display.

Dec 30, 2022
Nimble: Physics Engine for Deep Learning
Nimble: Physics Engine for Deep Learning

Nimble: Physics Engine for Deep Learning

Dec 27, 2022
Godot bindings for the Rapier3D physics engine

Godot bindings for the Rapier3D physics library How to use There are two parts: A Godot module which must be compiled with the engine.

Dec 26, 2022