Physics module — Box2D (2D) + Box3D (3D) rigid bodies, plus interactive cloth / SPH fluid. Script: physics <- eve.Physics(); world <- physics.newWorld(0, 900); world3 <- physics.newWorld3D(0, -9.8, 0);
更多...
#include <Physics.h>
Public 成员函数 | |
| Module_REG (Physics) | |
| Physics () | |
| ~Physics () override=default | |
| void | setMeter (float pixelsPerMeter) |
| Pixels per meter for 2D Box2D worlds (default 30, same as LÖVE). | |
| float | getMeter () const |
| World * | newWorld (float gravityX, float gravityY, bool sleep=true) |
| Create a 2D Box2D physics world. | |
| World3D * | newWorld3D (float gravityX, float gravityY, float gravityZ, bool sleep=true) |
| Create a 3D Box3D physics world. Coordinates are meters (Box3D native); +Y is up by convention. | |
| Cloth * | newCloth (int cols, int rows, float spacing, float originX, float originY) |
| Create a Verlet cloth grid (top row pinned). | |
| Fluid * | newFluid (int capacity=512) |
| Create an SPH fluid container with particle capacity. | |
Public 成员函数 继承自 eve::Module | |
| virtual | ~Module () |
| virtual std::string | getName () const =0 |
详细描述
Physics module — Box2D (2D) + Box3D (3D) rigid bodies, plus interactive cloth / SPH fluid. Script: physics <- eve.Physics(); world <- physics.newWorld(0, 900); world3 <- physics.newWorld3D(0, -9.8, 0);
构造及析构函数说明
◆ Physics()
| eve::physics::Physics::Physics | ( | ) |
在文件 Physics.cpp 第 18 行定义.
◆ ~Physics()
|
overridedefault |
成员函数说明
◆ getMeter()
| float eve::physics::Physics::getMeter | ( | ) | const |
在文件 Physics.cpp 第 28 行定义.
◆ Module_REG()
| eve::physics::Physics::Module_REG | ( | Physics | ) |
◆ newCloth()
| Cloth * eve::physics::Physics::newCloth | ( | int | cols, |
| int | rows, | ||
| float | spacing, | ||
| float | originX, | ||
| float | originY | ||
| ) |
Create a Verlet cloth grid (top row pinned).
- 参数
-
cols columns (>= 2) rows rows (>= 2) spacing particle spacing in pixels originX top-left X in pixels originY top-left Y in pixels
在文件 Physics.cpp 第 38 行定义.
引用了 spacing.
◆ newFluid()
| Fluid * eve::physics::Physics::newFluid | ( | int | capacity = 512 | ) |
Create an SPH fluid container with particle capacity.
- 参数
-
capacity max particles (>= 1)
在文件 Physics.cpp 第 42 行定义.
◆ newWorld()
| World * eve::physics::Physics::newWorld | ( | float | gravityX, |
| float | gravityY, | ||
| bool | sleep = true |
||
| ) |
Create a 2D Box2D physics world.
- 参数
-
gravityX gravity X in pixels/s² gravityY gravity Y in pixels/s² sleep allow sleeping bodies
在文件 Physics.cpp 第 30 行定义.
◆ newWorld3D()
| World3D * eve::physics::Physics::newWorld3D | ( | float | gravityX, |
| float | gravityY, | ||
| float | gravityZ, | ||
| bool | sleep = true |
||
| ) |
Create a 3D Box3D physics world. Coordinates are meters (Box3D native); +Y is up by convention.
- 参数
-
gravityX gravity X in m/s² gravityY gravity Y in m/s² gravityZ gravity Z in m/s² sleep allow sleeping bodies
在文件 Physics.cpp 第 34 行定义.
◆ setMeter()
| void eve::physics::Physics::setMeter | ( | float | pixelsPerMeter | ) |
Pixels per meter for 2D Box2D worlds (default 30, same as LÖVE).
在文件 Physics.cpp 第 22 行定义.
该类的文档由以下文件生成:
- src/modules/physics/Physics.h
- src/modules/physics/Physics.cpp
Public 成员函数 继承自