box3d README

The project's README from github.com/erincatto/box3d. As one markdown file: README.md.

Box3D

Build Status CLA assistant

Box3D Logo

Box3D is a 3D physics engine for games.

Introducing Box3D

Features

Collision

Physics

System

Samples

Building all platforms

This uses the presets in CMakePresets.json.

Run the samples app (must be in the Box3D directory).

Building for Visual Studio

Building for Linux

Building for Xcode

Building for Web

Box3D uses SSE2 with WebAssembly. Define BOX3D_DISABLE_SIMD to disable SSE2.

Building and installing

Using Box3D in your project

The core library has no dependencies beyond the C runtime (and libm on Unix). Linking it gives you the box3d::box3d target.

I recommend to use FetchContent:

include(FetchContent)
FetchContent_Declare(box3d
  GIT_REPOSITORY https://github.com/erincatto/box3d.git
  GIT_TAG v0.1.0)
FetchContent_MakeAvailable(box3d)

target_link_libraries(my_app PRIVATE box3d::box3d)

For a vendored copy or git submodule, point add_subdirectory at it:

add_subdirectory(extern/box3d)

target_link_libraries(my_app PRIVATE box3d::box3d)

To use a copy installed with cmake --install, find the package:

find_package(box3d 0.1 REQUIRED)

target_link_libraries(my_app PRIVATE box3d::box3d)

See docs/hello.md for a minimal first program.

Compatibility

The Box3D library and samples build and run on Windows, Linux, and Mac.

You will need a compiler that supports C17 to build the Box3D library.

You will need a compiler that supports C++20 to build the samples.

Box3D uses SSE2 and Neon SIMD math to improve performance. SIMD can be disabled by defining BOX3D_DISABLE_SIMD.

Documentation

The user manual lives in docs/ and is built with Doxygen. Enable the BOX3D_DOCS CMake option and build the doc target.

Community

Contributing

Pull requests are currently disabled. Instead, please file an issue for bugs or feature requests. For support, please visit the Discord server.

Giving feedback

Please file an issue or start a chat on discord. You can also use GitHub Discussions.

License

Box3D is developed by Erin Catto and uses the MIT license.

Sponsorship

Support development of Box3D through Github Sponsors.

Please consider starring this repository and subscribing to my YouTube channel.

LLM Usage

LLMs are used in the following areas:

Elsewhere all code is developed and written by me. I take responsibility for every line of code in Box2D/3D.

box3d (erincatto/box3d)

Searching Database…

6.6K ·GitHub
Что это такое?Box3D — это 3D-физический движок для игр, написанный Эрин Катто, автором Box2D.
Это библиотека, которую я подключаю к своей игре, или программа, которую я запускаю?Это C-библиотека, которую вы линкуете в свою игру — CMake-таргет называется box3d::box3d. В репозитории также есть приложение с примерами и интерфейсом на imgui, чтобы попробовать возможности.
Как добавить её в свой проект?Проще всего через CMake FetchContent; локальную копию или git-подмодуль подключают через add_subdirectory, а установленную копию — через find_package. В docs/hello.md разобрано, как написать минимальную первую программу.
Что нужно для сборки?CMake, git и компилятор с поддержкой C17. Самой библиотеке ничего не нужно, кроме C-рантайма (libm на Unix); для примеров дополнительно требуется C++20.
Есть ли подводные камни при сборке?По умолчанию используются SIMD-инструкции SSE2 и Neon, и даже сборка под WebAssembly опирается на SSE2 — на старом железе определите BOX3DDISABLESIMD, чтобы собрать без них.
На каких платформах она работает?Windows, Linux и macOS, для каждой есть CMake-пресеты (плюс MinGW и Xcode). Есть также сборка через Emscripten под WebAssembly.
Можно ли использовать её в коммерческой игре?Да — Box3D распространяется по лицензии MIT, так что коммерческое использование разрешено. Разработкой занимается Эрин Катто, проект поддерживается через GitHub Sponsors.
Какие физические возможности в неё входят?Коллизии: непрерывное обнаружение столкновений, выпуклые оболочки, капсулы, сферы, треугольные меши и карты высот, сенсоры, персонаж-мувер, а также ray cast, shape cast и запросы на пересечения. Физика: решатель твёрдых тел Soft Step, засыпание по островам и шарниры revolute, prismatic, distance, motor, weld и wheel с лимитами, моторами и пружинами.
Как попробовать её, прежде чем встраивать в игру?Соберите примеры с помощью CMake-пресетов — например, cmake --preset windows, затем cmake --build --preset windows-release — и запустите исполняемый файл примеров из каталога Box3D. В приложении есть интерфейс на imgui и демо большинства возможностей.
Это 3D-преемник Box2D?Фактически да. Проект создан Эрин Катто, автором Box2D, а в README упоминаются инструменты для переноса кода между Box2D и Box3D.
Автор писал её с помощью ИИ?Частично. LLM использовались для юнит-тестов, приложения с примерами, миграции кода между Box2D и Box3D, настройки сборки, ревью кода и бенчмарков; остальной код написан автором, который говорит, что отвечает за каждую строку.
What are similar projects?box2d, bgfx, JoltPhysics, raylib, iw4L, bevy, flutter_scene, GDevelop
Creator
erincatto
Size
3.6 MB
Stars
6.6K
Age
5mo
Commits · 90 Days