28struct WorldSnapshotAccess;
48 int getId()
const {
return id_; }
57 void setHitEventsEnabled(
bool enabled);
59 bool areHitEventsEnabled()
const;
62 std::string getKind()
const;
66 void setSphereRadius(
float radius);
80 void setConvexHullVertices(
const std::vector<float> &
vertices,
int maxVertices = 64);
83 return geometry_.kind == Kind::ConvexHull ?
static_cast<int>(geometry_.hullVertices.size() / 3) : 0;
91 void setTriangleMeshData(
const std::vector<float> &
vertices,
92 const std::vector<int32_t> &
indices,
bool weldVertices =
true,
93 float weldTolerance = 0.001f,
bool identifyEdges =
true,
94 bool useMedianSplit =
false);
97 return geometry_.kind == Kind::TriangleMesh ?
static_cast<int>(geometry_.meshVertices.size() / 3) : 0;
101 return geometry_.kind == Kind::TriangleMesh ?
static_cast<int>(geometry_.meshIndices.size() / 3) : 0;
104 void setTriangleMeshMaterialIndices(
const std::vector<int32_t> &materialIndices);
106 int getTriangleMeshMaterialIndex(
int triangleIndex)
const;
108 int getTriangleMeshMaterialCount()
const;
125 const std::string &frictionMode,
126 const std::string &restitutionMode);
128 float getTriangleMeshMaterialFriction(
int slot)
const;
130 float getTriangleMeshMaterialRestitution(
int slot)
const;
132 float getTriangleMeshMaterialRollingResistance(
int slot)
const;
134 int getTriangleMeshMaterialId(
int slot)
const;
136 void setHeightFieldHeights(
const std::vector<float> &heights);
138 void setHeightFieldRegion(
int x,
int z,
int width,
int depth,
139 const std::vector<float> &heights);
141 float getHeightFieldHeight(
int x,
int z)
const;
148 return geometry_.kind == Kind::HeightField ? geometry_.heightCellSizeX : 0.f;
152 return geometry_.kind == Kind::HeightField ? geometry_.heightCellSizeZ : 0.f;
156 return geometry_.kind == Kind::HeightField ? geometry_.heightGlobalMin : 0.f;
160 return geometry_.kind == Kind::HeightField ? geometry_.heightGlobalMax : 0.f;
163 float getBoxWidth()
const {
return geometry_.kind == Kind::Box ? 2.f * geometry_.a : 0.f; }
165 float getBoxHeight()
const {
return geometry_.kind == Kind::Box ? 2.f * geometry_.b : 0.f; }
167 float getBoxDepth()
const {
return geometry_.kind == Kind::Box ? 2.f * geometry_.c : 0.f; }
170 return geometry_.kind == Kind::Sphere ? geometry_.a : (geometry_.kind == Kind::Capsule ? geometry_.b : 0.f);
173 float getCapsuleHeight()
const {
return geometry_.kind == Kind::Capsule ? 2.f * geometry_.a : 0.f; }
184 void setOneWay(
float nx,
float ny,
float nz,
float planeOffset,
float margin,
187 void disableOneWay();
201 void setLocalTransform(
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw);
203 void setLocalPosition(
float x,
float y,
float z);
205 void setLocalRotation(
float qx,
float qy,
float qz,
float qw);
222 void setSensor(
bool sensor);
223 bool isSensor()
const;
227 float getFriction()
const;
230 float getRestitution()
const;
233 void setRollingResistance(
float resistance);
235 float getRollingResistance()
const;
237 void setTangentVelocity(
float x,
float y,
float z);
239 float getTangentVelocityX()
const;
241 float getTangentVelocityY()
const;
243 float getTangentVelocityZ()
const;
245 void setMaterialId(
int id);
247 int getMaterialId()
const;
249 void setExplosionScale(
float scale);
253 void setFrictionCombineMode(
const std::string &mode);
255 std::string getFrictionCombineMode()
const;
257 void setRestitutionCombineMode(
const std::string &mode);
259 std::string getRestitutionCombineMode()
const;
261 void setDensity(
float density);
262 float getDensity()
const;
266 void setFilterBits(uint64_t categoryBits, uint64_t maskBits);
267 uint64_t getCategoryBits()
const;
269 void setCategoryBits(uint64_t bits);
271 void setMaskBits(uint64_t bits);
273 uint64_t getMaskBits()
const;
275 void setGroupIndex(
int index);
276 int getGroupIndex()
const;
298 bool testPoint(
float x,
float y,
float z)
const;
304 bool isValid()
const;
318 void recreate(
bool sensor);
321 void enableContactOverrideFiltering();
322 void refreshOneWayWorldData();
323 bool allowsOneWayContact(
double pointX,
double pointY,
double pointZ,
float normalX,
324 float normalY,
float normalZ)
const;
328 std::unique_ptr<IShapeBackend3D> backend_;
331 std::vector<SurfaceMaterial3D> meshMaterials_;
332 bool meshMaterialsDirty_ =
false;
333 bool contactOverrideFiltering_ =
false;
334 float explosionScale_ = 1.f;
337 bool hitEventsEnabled_ =
false;
338 bool oneWayEnabled_ =
false;
339 float oneWayLocalNormalX_ = 0.f, oneWayLocalNormalY_ = 1.f,
340 oneWayLocalNormalZ_ = 0.f;
341 float oneWayPlaneOffset_ = 0.f;
342 float oneWayMargin_ = 0.05f;
343 float oneWayMinNormalDot_ = 0.1f;
344 double oneWayWorldPointX_ = 0.0, oneWayWorldPointY_ = 0.0, oneWayWorldPointZ_ = 0.0;
345 float oneWayWorldNormalX_ = 0.f, oneWayWorldNormalY_ = 1.f,
346 oneWayWorldNormalZ_ = 0.f;
#define EVENGINE_API_WORLD
std::vector< std::uint32_t > indices
std::array< float, 3 > scale
OceanRenderBackend backend
Process-local, generation-qualified handles owned by the physics domain.
std::array< double, 2 > vertices[3]
Backend-neutral 3D rigid body in meter-space coordinates (+Y up by convention). Owned by a World3D; c...
3D shape (box/sphere/capsule) attached to a Body3D with material settings. Created via Body3D::new*Sh...
const Body3D * getBody() const
Returns the owning body for read-only link construction.
int getId() const
Stable world-local id, preserved when sensor state recreates the backend shape.
float getHeightFieldCellSizeZ() const
Height-field cell spacing along local Z, or zero.
PhysicsShapeHandle runtimeHandle() const noexcept
Process-local generation-qualified handle owned by World3D.
int getHeightFieldCountZ() const
Height-field sample count along local Z, or zero.
float getLocalZ() const
Local translation Z in meters.
int getTriangleMeshVertexCount() const
Source vertex count for a triangle mesh, or zero.
float getLocalRotX() const
Normalized local quaternion X.
int getTag() const
User-defined integer tag, zero by default.
float getLocalY() const
Local translation Y in meters.
float getBoxHeight() const
Full box height, or zero for another geometry kind.
float getLocalX() const
Local translation X in meters.
bool isOneWay() const
Whether one-way pre-solve filtering is requested.
Shape3D & operator=(const Shape3D &)=delete
float getBoxWidth() const
Full box width, or zero for another geometry kind.
float getHeightFieldGlobalMin() const
Height-field shared quantization minimum, or zero.
float getLocalRotW() const
Normalized local quaternion scalar component.
Shape3D(const Shape3D &)=delete
float getExplosionScale() const
Current explosion impulse multiplier; zero opts this shape out.
float getCapsuleHeight() const
Capsule hemisphere-center distance, or zero for another kind.
float getBoxDepth() const
Full box depth, or zero for another geometry kind.
int getHeightFieldCountX() const
Height-field sample count along local X, or zero.
float getHeightFieldCellSizeX() const
Height-field cell spacing along local X, or zero.
float getLocalRotZ() const
Normalized local quaternion Z.
float getHeightFieldGlobalMax() const
Height-field shared quantization maximum, or zero.
int getTriangleMeshTriangleCount() const
Source triangle count for a triangle mesh, or zero.
Body3D * getBody()
Returns the owning body, or null after invalidation.
int getConvexHullPointCount() const
Source point count for a convex hull, or zero for another kind.
float getLocalRotY() const
Normalized local quaternion Y.
float getRadius() const
Sphere/capsule radius, or zero for a box.
int getConvexHullMaxVertices() const
Current convex-hull simplification budget, or zero for another kind.
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Optional physics backend for vehicle mobility and body attach.
ShapeKind3D
Geometry kinds supported by the rigid shape contract.
Owning, backend-independent shape source; metres, local quaternion XYZW.
Private bridge used exclusively by Box3D composition and native query code.