bulletphysics/bullet3
GitHub: bulletphysics/bullet3
Bullet3 是一个开源的实时物理仿真引擎,提供碰撞检测和刚体动力学模拟,广泛应用于游戏、机器人仿真和机器学习领域。
Stars: 14306 | Forks: 3049
[](https://travis-ci.org/bulletphysics/bullet3)
[](https://ci.appveyor.com/project/erwincoumans/bullet3)
# Bullet Physics SDK
这是 Bullet Physics SDK 的官方 C++ 源代码仓库:用于 VR、游戏、视觉效果、机器人技术、机器学习等的实时碰撞检测和多物理场模拟。

## 问题
Issue 追踪器因大量的支持问题而泛滥,目前已关闭直至清理完毕。请使用 [PyBullet 论坛](http://pybullet.org) 与他人进行讨论。
## PyBullet
强烈建议使用 PyBullet Python 绑定,以获得对机器人技术、强化学习和 VR 的更好支持。使用 pip install pybullet 并查看 [PyBullet 快速入门指南](https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#heading=h.2ye70wns7io3)。
安装非常简单:
```
pip3 install pybullet --upgrade --user
python3 -m pybullet_envs.examples.enjoy_TF_AntBulletEnv_v0_2017may
python3 -m pybullet_envs.examples.enjoy_TF_HumanoidFlagrunHarderBulletEnv_v1_2017jul
python3 -m pybullet_envs.deep_mimic.testrl --arg_file run_humanoid3d_backflip_args.txt
```
如果您在研究中使用 PyBullet,请按以下方式引用:
```
@MISC{coumans2021,
author = {Erwin Coumans and Yunfei Bai},
title = {PyBullet, a Python module for physics simulation for games, robotics and machine learning},
howpublished = {\url{http://pybullet.org}},
year = {2016--2021}
}
```
## Bullet Physics C++ 的要求
需要一个支持 C++ 2003 的 C++ 编译器。该库已在 Windows、Linux、Mac OSX、iOS、Android 上经过测试,
但应该可以在任何具有 C++ 编译器的平台上运行。
一些可选的演示需要 OpenGL 2 或 OpenGL 3,也有一些非图形化的演示和单元测试。
## 实验性 OpenCL GPGPU 支持的要求
整个碰撞检测和刚体动力学可以在 GPU 上执行。
需要高端桌面 GPU,例如 AMD Radeon 7970 或 NVIDIA GTX 680 或更好的型号。
我们已在 Windows、Linux 和 Mac OSX 下成功测试了该软件。
该软件目前无法在 OpenCL CPU 设备上运行。它可能可以在笔记本电脑 GPU 上运行,但性能可能不会很好。请注意,
OpenCL 驱动程序通常无法编译内核。虽然存在一些单元测试来
追踪问题,但还需要更多工作来覆盖所有 OpenCL 内核。
## 许可证
所有源代码文件均根据宽松的 zlib 许可证
(http://opensource.org/licenses/Zlib) 授权,除非在特定文件夹/文件中另有标记。
## 使用 vcpkg 构建 Bullet 的说明
您可以使用 [vcpkg](https://github.com/Microsoft/vcpkg/) 依赖管理器下载并安装 Bullet:
```
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install bullet3
```
vcpkg 中的 Bullet 端口由 Microsoft 团队成员和社区贡献者保持更新。如果版本已过期,请在 vcpkg 仓库中 [创建 issue 或 pull request](https://github.com/Microsoft/vcpkg)。
## 使用 premake 构建 Bullet 的说明。您也可以改用 cmake。
**Windows**
点击 build_visual_studio_vr_pybullet_double.bat 并打开 build3/vs2010/0_Bullet3Solution.sln
当被提示时,将项目转换为较新版本的 Visual Studio。
如果您将 Python 安装在 C:\ 根目录中,批处理文件应能自动找到它。
否则,请编辑此批处理文件以选择 Python include/lib 目录的位置。
**适用于 HTC Vive 和 Oculus Rift 的 Windows 虚拟现实沙盒**
构建并运行 App_SharedMemoryPhysics_VR 项目,最好使用 Release/优化构建。
您可以使用以下命令从 Python pybullet 连接到沙盒:
```
import pybullet as p
p.connect(p.SHARED_MEMORY) #or (p.TCP, "localhost", 6667) or (p.UDP, "192.168.86.10",1234)
```
**Linux 和 Mac OSX gnu make**
确保已安装 gcc 和 cmake(Linux 使用 `sudo apt-get install build-essential` 和 `sudo apt-get install cmake`,Mac 使用 `brew install cmake`,或访问 https://cmake.org)
在终端中输入:
```
./build_cmake_pybullet_double.sh
```
此脚本将调用 cmake 并在 build_cmake 目录中进行构建。您可以在 Bullet/examples/pybullet 中找到 pybullet。
BulletExampleBrowser 二进制文件将位于 Bullet/examples/ExampleBrowser。
您也可以使用 premake 构建 Bullet。build3 文件夹中有 premake 可执行文件。
根据您的系统(Linux 32位、64位或 Mac OSX)使用以下命令之一
使用 premake:
```
cd build3
./premake4_linux --double gmake
./premake4_linux64 --double gmake
./premake4_osx --double --enable_pybullet gmake
```
然后
```
cd gmake
make
```
请注意,在 Linux 上,您需要使用 cmake 来构建 pybullet,因为编译器存在混合使用共享库和静态库的问题。
**Mac OSX Xcode**
点击 build3/xcode4.command 或在终端窗口中执行
```
./premake_osx xcode4
```
## 用法
App_ExampleBrowser 可执行文件将位于 bin 文件夹中。
您可以通过终端/命令提示符运行它,或者直接点击它。
```
[--start_demo_name="Demo Name"] Start with a selected demo
[--mp4=moviename.mp4] Create a mp4 movie of the window, requires ffmpeg installed
[--mouse_move_multiplier=0.400000] Set the mouse move sensitivity
[--mouse_wheel_multiplier=0.01] Set the mouse wheel sensitivity
[--background_color_red= 0.9] Set the red component for background color. Same for green and blue
[--fixed_timestep= 0.0] Use either a real-time delta time (0.0) or a fixed step size (0.016666)
```
您可以使用鼠标拾取来抓取物体。按住 ALT 或 CONTROL 键时,您可以使用 Maya 风格的相机鼠标控制。
按 F1 创建一系列屏幕截图。按 ESCAPE 退出演示应用程序。
查看 docs 文件夹和 Bullet physics 论坛以获取更多信息。
标签:Apex, Bash脚本, Bullet Physics, C++, PyBullet, Python, Veh, VR/AR, 人工智能, 刚体动力学, 多体动力学仿真, 实时碰撞检测, 开源库, 强化学习, 搜索引擎爬虫, 数据擦除, 无后门, 机器人仿真, 机器学习, 游戏开发, 物理引擎, 物理模拟, 用户模式Hook绕过, 视觉特效, 计算机图形学, 逆向工具