载入中...
搜索中...
未找到
Physics.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Module.h"
4
5namespace eve::physics {
6
7class World;
8class World3D;
9class Cloth;
10class Fluid;
11
17class Physics : public Module {
18public:
20 Physics();
21 ~Physics() override = default;
22
24 void setMeter(float pixelsPerMeter);
25 float getMeter() const;
26
33 World *newWorld(float gravityX, float gravityY, bool sleep = true);
34
43 World3D *newWorld3D(float gravityX, float gravityY, float gravityZ, bool sleep = true);
44
53 Cloth *newCloth(int cols, int rows, float spacing, float originX, float originY);
54
59 Fluid *newFluid(int capacity = 512);
60
61private:
62 float meter_ = 30.f;
63};
64
65} // namespace eve::physics
int spacing
Interactive 2D cloth — Verlet particles + distance constraints. Pixel space (same convention as Box2D...
Definition Cloth.h:17
Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent o...
Definition Fluid.h:17
Physics module — Box2D (2D) + Box3D (3D) rigid bodies, plus interactive cloth / SPH fluid....
Definition Physics.h:17
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.
Definition Physics.cpp:34
void setMeter(float pixelsPerMeter)
Pixels per meter for 2D Box2D worlds (default 30, same as LÖVE).
Definition Physics.cpp:22
Fluid * newFluid(int capacity=512)
Create an SPH fluid container with particle capacity.
Definition Physics.cpp:42
Cloth * newCloth(int cols, int rows, float spacing, float originX, float originY)
Create a Verlet cloth grid (top row pinned).
Definition Physics.cpp:38
float getMeter() const
Definition Physics.cpp:28
World * newWorld(float gravityX, float gravityY, bool sleep=true)
Create a 2D Box2D physics world.
Definition Physics.cpp:30
~Physics() override=default
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:18
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
Definition World.h:31