Magnum::BulletIntegration namespace

Integration with Bullet Physics.

Contents

Conversion of matrix and vector classes, wrappers for rigid body dynamics.

This library depends on the Bullet Physics library and is built if WITH_BULLET is enabled when building Magnum Integration. To use this library with CMake, put FindMagnumIntegration.cmake and FindBullet.cmake into your modules/ directory, request the Bullet component of the MagnumIntegration package and link to the MagnumIntegration::Bullet target:

find_package(MagnumIntegration REQUIRED Bullet)

# ...
target_link_libraries(your-app PRIVATE MagnumIntegration::Bullet)

Additionally, if you're using Magnum as a CMake subproject, bundle the magnum-integration and bullet3 repositories and do the following before calling find_package(). If you want to use system-installed Bullet, omit the first part and point CMAKE_PREFIX_PATH to its installation dir if necessary.

# Disable Bullet tests and demos
set(BUILD_UNIT_TESTS OFF CACHE BOOL "" FORCE)
set(BUILD_BULLET2_DEMOS OFF CACHE BOOL "" FORCE)
set(BUILD_CPU_DEMOS OFF CACHE BOOL "" FORCE)
set(BUILD_OPENGL3_DEMOS OFF CACHE BOOL "" FORCE)
# While not needed for Magnum, you might actually want some of those
set(BUILD_ENET OFF CACHE BOOL "" FORCE)
set(BUILD_CLSOCKET OFF CACHE BOOL "" FORCE)
set(BUILD_EXTRAS OFF CACHE BOOL "" FORCE)
set(BUILD_BULLET3 OFF CACHE BOOL "" FORCE)
# This is needed in case BUILD_EXTRAS is enabled, as you'd get a CMake syntax
# error otherwise
set(PKGCONFIG_INSTALL_PREFIX "lib${LIB_SUFFIX}/pkgconfig/")
# Bullet's buildsystem doesn't correctly express dependencies between static
# libs, causing linker errors on Magnum side. If you have CMake 3.13, the Find
# module is able to correct that on its own, otherwise you need to enable
# BUILD_SHARED_LIBS to build as shared.
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
# If you want to use double precision, uncomment these two (note that you'll
# need a double-precision SceneGraph as well)
#set(USE_DOUBLE_PRECISION ON CACHE BOOL "" FORCE)
#add_definitions(-DBT_USE_DOUBLE_PRECISION)
add_subdirectory(bullet3 EXCLUDE_FROM_ALL)

set(WITH_BULLET ON CACHE BOOL "" FORCE)
add_subdirectory(magnum-integration EXCLUDE_FROM_ALL)

In case you get errors like the following, be sure to set CMAKE_BUILD_TYPE to a valid non-empty value when configuring. Additionally, Bullet's CMakeLists print a bunch of debug variables when configuring, that's something you have to live with.

ninja: error: 'lib/libLinearMath.a', needed by 'lib/libMagnumBulletIntegration.so.2.4', missing and no known rule to make it

This library provides routines for explicit conversion between Bullet and Magnum math types, in the Magnum/BulletIntegration/Integration.h header, see its documentation for more information. See also the Bullet Physics example, Downloading and building integration libraries and Integration library usage with CMake.

Classes

class DebugDraw
Bullet physics debug visualization.
class MotionState
Bullet Physics motion state.

Functions

auto operator<<(Debug& debug, DebugDraw::Mode value) -> Debug&
Debug output operator.

Function documentation

Debug& Magnum::BulletIntegration::operator<<(Debug& debug, DebugDraw::Mode value)

Debug output operator.