载入中...
搜索中...
未找到
Physics.cpp
浏览该文件的文档.
370 world3.addFunc("getContactPointTotalNormalImpulse", &World3D::getContactPointTotalNormalImpulse);
1052 std::function<SoftBody3DRenderer *()>([]() -> SoftBody3DRenderer * { return nullptr; }), true);
The single Squirrel projection for common Result, Status and Value.
3D rigid body (Box3D) in meter-space coordinates (+Y up by convention). Owned by a World3D; create pr...
Definition Body3D.h:24
bool isAngularYLocked() const
Whether rotation around Y is locked.
bool isAngularXLocked() const
Whether rotation around X is locked.
void setRotation(float qx, float qy, float qz, float qw)
Orientation as quaternion (x, y, z, w).
Definition Body3D.cpp:274
std::vector< float > localToWorldVector(float x, float y, float z) const
Rotates a body-local direction/vector into world space; returns {x,y,z}.
Definition Body3D.cpp:386
float getInertiaYZ() const
Local symmetric inertia tensor YZ component.
std::vector< float > worldToLocalVector(float x, float y, float z) const
Rotates a world direction/vector into body-local space; returns {x,y,z}.
Definition Body3D.cpp:400
float getLocalCenterY() const
Local center of mass Y coordinate.
void setAngularDamping(float damping)
Angular damping coefficient, finite and non-negative.
Definition Body3D.cpp:529
bool isAngularZLocked() const
Whether rotation around Z is locked.
void applyForce(float fx, float fy, float fz)
Force applied at the center of mass.
Definition Body3D.cpp:428
float getWorldCenterX() const
World center of mass X coordinate.
std::vector< float > localToWorldPoint(float x, float y, float z) const
Converts a body-local point to world coordinates; returns {x,y,z}.
Definition Body3D.cpp:356
void applyLinearImpulse(float ix, float iy, float iz)
Instantaneous linear impulse.
Definition Body3D.cpp:443
void setFixedRotation(bool fixed)
Lock all angular axes (Box3D motion locks).
Definition Body3D.cpp:676
void applyAngularImpulse(float ix, float iy, float iz)
Instantaneous angular impulse.
Definition Body3D.cpp:453
float getInertiaYY() const
Local inertia tensor YY component about the center of mass.
void setLinearDamping(float damping)
Linear damping coefficient, finite and non-negative.
Definition Body3D.cpp:519
std::vector< float > worldToLocalPoint(float x, float y, float z) const
Converts a world point to body-local coordinates; returns {x,y,z}.
Definition Body3D.cpp:372
void applyLocalForceToCenter(float fx, float fy, float fz)
Body-local force applied at the center of mass.
Definition Body3D.cpp:467
bool isLinearYLocked() const
Whether translation along Y is locked.
Shape3D * newBoxShape(float width, float height, float depth, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates a box shape in meter-space units.
Definition Body3D.cpp:715
void applyLinearImpulseAt(float ix, float iy, float iz, float x, float y, float z)
Instantaneous linear impulse applied at a world position.
Definition Body3D.cpp:448
float getInertiaXZ() const
Local symmetric inertia tensor XZ component.
void setMassProperties(float mass, float centerX, float centerY, float centerZ, float inertiaXX, float inertiaYY, float inertiaZZ, float inertiaXY=0.f, float inertiaXZ=0.f, float inertiaYZ=0.f)
Overrides mass, local center of mass, and the symmetric local inertia tensor.
Definition Body3D.cpp:588
void setTargetTransform(float x, float y, float z, float qx, float qy, float qz, float qw, float timeStep)
Drives a kinematic body to a target pose over a positive time step. The target quaternion is normaliz...
Definition Body3D.cpp:504
void applyLocalForce(float fx, float fy, float fz, float x, float y, float z)
Body-local force applied at a body-local point.
Definition Body3D.cpp:458
bool isLinearZLocked() const
Whether translation along Z is locked.
float getLocalCenterZ() const
Local center of mass Z coordinate.
bool isLinearXLocked() const
Whether translation along X is locked.
void setSleepEnabled(bool enabled)
Enables or disables automatic sleeping for this body.
Definition Body3D.cpp:549
void applyLocalLinearImpulseToCenter(float ix, float iy, float iz)
Body-local linear impulse applied at the center of mass.
Definition Body3D.cpp:490
void applyTorque(float tx, float ty, float tz)
Torque applied in world space.
Definition Body3D.cpp:438
float getInertiaXX() const
Local inertia tensor XX component about the center of mass.
void setMotionLocks(bool linearX, bool linearY, bool linearZ, bool angularX, bool angularY, bool angularZ)
Atomically locks translation and rotation on individual local solver axes.
Definition Body3D.cpp:568
void applyForceAt(float fx, float fy, float fz, float x, float y, float z)
Force applied at a world position.
Definition Body3D.cpp:433
void resetMassProperties()
Restores automatic mass, center, and inertia calculation from attached shapes.
Definition Body3D.cpp:627
float getInertiaXY() const
Local symmetric inertia tensor XY component.
float getWorldCenterZ() const
World center of mass Z coordinate.
float getInertiaZZ() const
Local inertia tensor ZZ component about the center of mass.
Shape3D * newCapsuleShape(float height, float radius, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates a capsule along local Y.
Definition Body3D.cpp:753
void setLinearVelocity(float vx, float vy, float vz)
Linear velocity in m/s.
Definition Body3D.cpp:311
void applyLocalLinearImpulse(float ix, float iy, float iz, float x, float y, float z)
Body-local linear impulse applied at a body-local point.
Definition Body3D.cpp:480
float getWorldCenterY() const
World center of mass Y coordinate.
void setGravityScale(float scale)
Multiplier applied to world gravity; may be negative.
Definition Body3D.cpp:539
void setType(const std::string &bodyType)
"static" | "kinematic" | "dynamic".
Definition Body3D.cpp:656
float getLocalCenterX() const
Local center of mass X coordinate.
std::vector< float > getWorldPointVelocity(float x, float y, float z) const
World-space velocity at the supplied world point.
Definition Body3D.cpp:421
void setAngularVelocity(float wx, float wy, float wz)
Angular velocity in rad/s.
Definition Body3D.cpp:336
void setSleepThreshold(float threshold)
Sleep velocity threshold, finite and non-negative.
Definition Body3D.cpp:558
std::vector< float > getLocalPointVelocity(float x, float y, float z) const
World-space velocity at a point expressed in body-local coordinates.
Definition Body3D.cpp:407
Shape3D * newSphereShape(float radius, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates a sphere shape in meter-space units.
Definition Body3D.cpp:735
void applyLocalAngularImpulse(float ix, float iy, float iz)
Body-local angular impulse.
Definition Body3D.cpp:497
Fixture * newRectangleFixture(float width, float height, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates a rectangle fixture in pixel-space units.
Definition Body.cpp:228
void applyForceAt(float fx, float fy, float x, float y)
Force applied at a world pixel position.
Definition Body.cpp:173
void setBullet(bool bullet)
CCD bullet mode (recommended for fast small bodies).
Definition Body.cpp:214
Fixture * newCircleFixture(float radius, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates a circular fixture in pixel-space units.
Definition Body.cpp:256
void applyForce(float fx, float fy)
Force (pixels/s² * kg) applied at the center of mass.
Definition Body.cpp:167
Fixture * newRectangleFixtureAt(float width, float height, float offsetX, float offsetY, float density=1.f, float friction=0.2f, float restitution=0.f)
Creates an offset rectangle fixture in pixel-space units.
Definition Body.cpp:233
Regular 3D signed-distance grid for terrain and voxel collision queries. Negative samples are solid,...
Definition DistanceField3D.h:16
float getMoverGroundDot() const
Greatest dot product between mover Up and a normal from the latest move.
Definition DistanceField3D.h:169
void setMoverGroundSnap(float distance)
Set the non-negative distance used to snap onto walkable ground after movement.
Definition DistanceField3D.cpp:393
float getCollisionDistance() const
Signed clearance from the last check (negative means penetration).
Definition DistanceField3D.h:125
float getCastDistance() const
World-space travel distance at the last cast hit.
Definition DistanceField3D.h:149
void fill(float distance)
Set every grid sample to the same finite distance.
Definition DistanceField3D.cpp:66
bool moveCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float deltaX, float deltaY, float deltaZ)
Resolve a capsule displacement against the field with sliding and depenetration. The capsule coordina...
Definition DistanceField3D.cpp:407
float getCollisionY() const
Y coordinate of the closest sampled point from the last collision check.
Definition DistanceField3D.h:129
void setMoverUp(float x, float y, float z)
Set the normalized reference-up direction used for ground classification.
Definition DistanceField3D.cpp:369
void fillRegion(int x, int y, int z, int width, int height, int depth, float distance)
Fill an in-bounds grid subregion with one finite signed distance.
Definition DistanceField3D.cpp:98
bool isMoverGrounded() const
Whether the latest move encountered a normal within the walkable slope limit.
Definition DistanceField3D.h:167
float getMoverGroundSnap() const
Current post-move ground-snap distance.
Definition DistanceField3D.h:119
void sampleNormal(float x, float y, float z)
Estimate the normalized outward field gradient at a world position.
Definition DistanceField3D.cpp:151
float getOriginX() const
World-space X coordinate of grid vertex (0,0,0).
Definition DistanceField3D.h:58
float getMoverStepHeight() const
Current automatic step height; zero disables step climbing.
Definition DistanceField3D.h:123
bool checkCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius)
Test a capsule defined by two sphere centers against the solid.
Definition DistanceField3D.cpp:210
float getOriginY() const
World-space Y coordinate of grid vertex (0,0,0).
Definition DistanceField3D.h:60
float getCellSize() const
World-space distance between adjacent grid vertices.
Definition DistanceField3D.h:56
float getOutsideDistance() const
Distance returned for world samples outside the grid.
Definition DistanceField3D.h:64
float getNormalZ() const
Z component of the most recently sampled collision normal.
Definition DistanceField3D.h:75
float getMoverDeltaX() const
Resolved X displacement from the most recent moveCapsule call.
Definition DistanceField3D.h:153
unsigned int getRevision() const
Monotonic wrapping counter incremented once after each successful mutation.
Definition DistanceField3D.h:66
float getShapeContactY() const
Y coordinate on the sphere or capsule surface along the contact normal.
Definition DistanceField3D.h:141
void setMoverSlopeLimit(float degrees)
Set the maximum walkable slope angle in degrees, clamped to [0, 89.9].
Definition DistanceField3D.cpp:380
bool castCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float deltaX, float deltaY, float deltaZ)
Sweep a capsule through the field and cache the earliest contact.
Definition DistanceField3D.cpp:313
float getNormalX() const
X component of the most recently sampled collision normal.
Definition DistanceField3D.h:71
bool castSphere(float x, float y, float z, float radius, float deltaX, float deltaY, float deltaZ)
Sweep a sphere through the field and cache the earliest contact.
Definition DistanceField3D.cpp:265
float getMoverNormalX() const
X component of the most recent blocking or recovery normal.
Definition DistanceField3D.h:159
float getMoverDeltaZ() const
Resolved Z displacement from the most recent moveCapsule call.
Definition DistanceField3D.h:157
bool didCastStartInside() const
Whether the most recent cast began overlapping the solid.
Definition DistanceField3D.h:151
float getCollisionX() const
X coordinate of the closest sampled point from the last collision check.
Definition DistanceField3D.h:127
int getMoverIterations() const
Number of solver passes used by the most recent moveCapsule call.
Definition DistanceField3D.h:165
float getShapeContactZ() const
Z coordinate on the sphere or capsule surface along the contact normal.
Definition DistanceField3D.h:143
float getNormalY() const
Y component of the most recently sampled collision normal.
Definition DistanceField3D.h:73
bool didMoverHitWall() const
Whether the latest move encountered a non-walkable contact normal.
Definition DistanceField3D.h:171
void setMoverSkinWidth(float width)
Set the non-negative separation retained from surfaces by moveCapsule.
Definition DistanceField3D.cpp:387
float getSurfaceX() const
X coordinate of the projected signed-distance-field surface point.
Definition DistanceField3D.h:133
float getCastFraction() const
Fraction in [0,1] of the requested displacement at the last cast hit.
Definition DistanceField3D.h:147
float getMoverDeltaY() const
Resolved Y displacement from the most recent moveCapsule call.
Definition DistanceField3D.h:155
void setDistance(int x, int y, int z, float distance)
Set a signed-distance sample at a grid vertex.
Definition DistanceField3D.cpp:114
float getCollisionZ() const
Z coordinate of the closest sampled point from the last collision check.
Definition DistanceField3D.h:131
float getShapeContactX() const
X coordinate on the sphere or capsule surface along the contact normal.
Definition DistanceField3D.h:139
bool checkSphere(float x, float y, float z, float radius)
Test a sphere against the solid (distance <= radius).
Definition DistanceField3D.cpp:203
float getPenetrationDepth() const
Non-negative overlap depth from the most recent overlap, cast, or move query.
Definition DistanceField3D.h:145
float getSurfaceZ() const
Z coordinate of the projected signed-distance-field surface point.
Definition DistanceField3D.h:137
float getSurfaceY() const
Y coordinate of the projected signed-distance-field surface point.
Definition DistanceField3D.h:135
float getMoverNormalZ() const
Z component of the most recent blocking or recovery normal.
Definition DistanceField3D.h:163
void setMoverStepHeight(float height)
Set the maximum non-negative ledge height automatically climbed by moveCapsule.
Definition DistanceField3D.cpp:400
float getMoverSkinWidth() const
Current mover separation from collision surfaces.
Definition DistanceField3D.h:115
float sample(float x, float y, float z) const
Trilinearly sample the field in world coordinates.
Definition DistanceField3D.cpp:126
float getOriginZ() const
World-space Z coordinate of grid vertex (0,0,0).
Definition DistanceField3D.h:62
float getDistance(int x, int y, int z) const
Read a grid vertex; out-of-range vertices return the outside distance.
Definition DistanceField3D.cpp:122
float getMoverNormalY() const
Y component of the most recent blocking or recovery normal.
Definition DistanceField3D.h:161
void setSensor(bool sensor)
Sensor fixtures report contacts but never collide.
Definition Fixture.cpp:43
bool testPoint(float x, float y) const
Pixel-space point-in-fixture test (uses World meter).
Definition Fixture.cpp:105
void setCategoryBits(int bits)
Collision filtering (Box2D category/mask bits, group index).
Definition Fixture.cpp:72
void setTag(const std::string &tag)
Arbitrary string tag surfaced in begin/end contact events.
Definition Fixture.h:49
Interactive 2D particle fluid (double-density relaxation) in pixel space. Script-owned; independent o...
Definition Fluid2D.h:19
void setBounds(float x, float y, float w, float h)
Axis-aligned container; particles bounce inside.
Definition Fluid2D.cpp:51
void setRestDensity(float density)
Target rest density for the relaxation solver (default 4).
Definition Fluid2D.cpp:38
int emit(float x, float y, int count, float vx=0.f, float vy=0.f)
Spawn up to count particles at (x,y) with initial velocity. Returns number actually added.
Definition Fluid2D.cpp:65
void setSmoothingRadius(float radius)
Interaction / neighbor radius in pixels (default 18).
Definition Fluid2D.cpp:33
void setNearPressureStiffness(float k)
Near-pressure (anti-clustering) stiffness (default 0.5).
Definition Fluid2D.cpp:45
void interactAt(float x, float y, float radius, float strength)
Mouse / pointer interaction: positive strength attracts, negative repels. Applied as acceleration wit...
Definition Fluid2D.cpp:89
void setWheelSpring(float frequencyHz, float dampingRatio)
Configures wheel suspension spring.
Definition Joint2D.cpp:213
void setPrismaticMotor(bool enabled, float speedPixels, float maxForcePixels)
Configures a prismatic motor in pixels/second and pixel-force units.
Definition Joint2D.cpp:178
void setMotorAngularOffset(float radians)
Sets motor-joint angular offset in radians.
Definition Joint2D.cpp:246
void setWeldSpring(float frequencyHz, float dampingRatio)
Configures weld rotational spring frequency and damping.
Definition Joint2D.cpp:196
void setPrismaticLimits(bool enabled, float lowerPixels, float upperPixels)
Configures prismatic translation limits in pixels.
Definition Joint2D.cpp:168
void setCollideConnected(bool collide)
Enables or disables collision between the attached bodies.
Definition Joint2D.cpp:92
void setMotorLimits(float maxForcePixels, float maxTorque)
Sets motor max force (pixel-force) and torque (N·m).
Definition Joint2D.cpp:251
void setWheelMotor(bool enabled, float speed, float maxTorque)
Configures wheel spin motor in radians/second and newton-metres.
Definition Joint2D.cpp:221
int getBodyBId() const
Stable ID of attached body B, or -1 after invalidation.
Definition Joint2D.cpp:90
void setDistanceSpring(float frequencyHz, float dampingRatio)
Configures distance spring frequency (Hz) and damping ratio.
Definition Joint2D.cpp:119
float getWheelTranslation() const
Current wheel translation along the suspension axis in pixels.
Definition Joint2D.cpp:230
int getBodyAId() const
Stable ID of attached body A, or -1 after invalidation.
Definition Joint2D.cpp:89
void setRevoluteMotor(bool enabled, float speed, float maxTorque)
Configures the revolute motor in radians/second and newton-metres.
Definition Joint2D.cpp:146
void setRevoluteLimits(bool enabled, float lower, float upper)
Configures revolute angular limits in radians.
Definition Joint2D.cpp:136
float getPrismaticTranslation() const
Current prismatic translation in pixels.
Definition Joint2D.cpp:187
void setDistanceLength(float lengthPixels)
Changes distance-joint rest length in pixels.
Definition Joint2D.cpp:110
void setMotorLinearOffset(float xPixels, float yPixels)
Sets motor-joint linear offset in pixels (bodyA frame).
Definition Joint2D.cpp:239
float getRevoluteMotorTorque() const
Current revolute motor torque in newton-metres.
Definition Joint2D.cpp:163
float getConstraintForceX() const
Current world-space constraint force X in newtons.
void setDistanceLength(float length)
Changes distance-joint rest length in metres.
Definition Joint3D.cpp:119
float getConstraintForceY() const
Current world-space constraint force Y in newtons.
void setForceThreshold(float threshold)
Sets the force threshold that emits a joint-stress event, in newtons.
Definition Joint3D.cpp:80
void setWheelSteering(bool enabled, float targetAngle, float hertz, float dampingRatio, float maxTorque)
Configures steering target, stiffness, damping and maximum torque.
Definition Joint3D.cpp:299
void setMotorVelocityLimits(float maxForce, float maxTorque)
Sets motor velocity force/torque limits.
Definition Joint3D.cpp:383
void setWheelSpinMotor(bool enabled, float speed, float maxTorque)
Configures wheel spin motor speed and maximum torque.
Definition Joint3D.cpp:291
void setSphericalTwistLimits(bool enabled, float lower, float upper)
Enables spherical twist limits in radians.
Definition Joint3D.cpp:244
float getTorqueThreshold() const
Current torque event threshold in newton-metres.
Definition Joint3D.cpp:93
float getParallelMaxTorque() const
Parallel maximum spring torque in newton-metres.
Definition Joint3D.cpp:450
float getWheelSpinTorque() const
Current wheel spin motor torque in newton-metres.
Definition Joint3D.cpp:325
void setRevoluteLimits(bool enabled, float lower, float upper)
Configures revolute angular limits in radians.
Definition Joint3D.cpp:169
void setDistanceMotor(bool enabled, float speed, float maxForce)
Configures the distance motor in metres/second and newtons.
Definition Joint3D.cpp:149
float getRevoluteMotorTorque() const
Current revolute motor torque in newton-metres.
Definition Joint3D.cpp:190
void setMotorAngularVelocity(float wx, float wy, float wz)
Sets motor-joint relative angular velocity in radians/second.
Definition Joint3D.cpp:376
void setSphericalMotor(bool enabled, float velocityX, float velocityY, float velocityZ, float maxTorque)
Configures spherical motor velocity and maximum torque.
Definition Joint3D.cpp:254
void setTorqueThreshold(float threshold)
Sets the torque threshold that emits a joint-stress event, in newton-metres.
Definition Joint3D.cpp:88
void setWeldLinearSpring(float hertz, float dampingRatio)
Configures weld linear spring stiffness and damping; 0 hertz is rigid.
Definition Joint3D.cpp:338
float getDistanceCurrentLength() const
Current anchor-to-anchor distance in metres.
Definition Joint3D.cpp:128
float getPrismaticTranslation() const
Current prismatic translation in metres.
Definition Joint3D.cpp:223
void setDistanceLimits(bool enabled, float minimum, float maximum)
Configures optional distance limits in metres.
Definition Joint3D.cpp:140
float getConstraintTorqueZ() const
Current world-space constraint torque Z in newton-metres.
float getWheelSpinSpeed() const
Current wheel spin speed in radians/second.
Definition Joint3D.cpp:321
void setWheelSteeringLimits(bool enabled, float lower, float upper)
Configures steering angular limits in radians.
Definition Joint3D.cpp:312
float getPrismaticMotorForce() const
Current prismatic motor force in newtons.
Definition Joint3D.cpp:231
void setRevoluteSpring(bool enabled, float targetAngle, float hertz, float dampingRatio)
Configures a revolute angular spring in radians.
Definition Joint3D.cpp:158
void setPrismaticLimits(bool enabled, float lower, float upper)
Configures prismatic translation limits in metres.
Definition Joint3D.cpp:206
std::string getKind() const
Joint kind string for script/debug ("distance", "revolute", …, "filter").
Definition Joint3D.cpp:54
float getMotorLinearVelocityX() const
Desired motor linear velocity X in metres/second.
Definition Joint3D.cpp:408
void setParallelSpring(float hertz, float dampingRatio, float maxTorque)
Configures parallel-joint spring stiffness, damping and torque cap.
Definition Joint3D.cpp:433
void setMotorLinearVelocity(float vx, float vy, float vz)
Sets motor-joint relative linear velocity in metres/second.
Definition Joint3D.cpp:369
float getMotorAngularVelocityY() const
Desired motor angular velocity Y in radians/second.
Definition Joint3D.cpp:424
float getLinearSeparation() const
Current inadmissible linear separation error in metres.
Definition Joint3D.cpp:107
float getMotorAngularVelocityX() const
Desired motor angular velocity X in radians/second.
Definition Joint3D.cpp:420
float getWheelSteeringTorque() const
Current steering torque in newton-metres.
Definition Joint3D.cpp:333
float getMotorAngularVelocityZ() const
Desired motor angular velocity Z in radians/second.
Definition Joint3D.cpp:428
float getConstraintTorqueX() const
Current world-space constraint torque X in newton-metres.
float getConstraintForceZ() const
Current world-space constraint force Z in newtons.
float getMotorLinearVelocityY() const
Desired motor linear velocity Y in metres/second.
Definition Joint3D.cpp:412
float getAngularSeparation() const
Current inadmissible angular separation error in radians.
Definition Joint3D.cpp:110
float getMotorLinearVelocityZ() const
Desired motor linear velocity Z in metres/second.
Definition Joint3D.cpp:416
float getWheelSteeringAngle() const
Current wheel steering angle in radians.
Definition Joint3D.cpp:329
void setDistanceSpring(bool enabled, float hertz, float dampingRatio)
Configures a distance spring; hertz and damping must be non-negative.
Definition Joint3D.cpp:132
void setRevoluteMotor(bool enabled, float speed, float maxTorque)
Configures the revolute motor in radians/second and newton-metres.
Definition Joint3D.cpp:178
int getBodyAId() const
Stable ID of attached body A, or -1 after invalidation.
Definition Joint3D.cpp:69
void setWheelSuspensionLimits(bool enabled, float lower, float upper)
Configures wheel suspension travel limits in metres.
Definition Joint3D.cpp:282
float getPrismaticSpeed() const
Current prismatic translation speed in metres/second.
Definition Joint3D.cpp:227
void setMotorAngularSpring(float hertz, float dampingRatio, float maxTorque)
Configures motor angular position spring.
Definition Joint3D.cpp:399
float getSphericalConeAngle() const
Current spherical cone angle in radians.
Definition Joint3D.cpp:265
void setPrismaticMotor(bool enabled, float speed, float maxForce)
Configures a prismatic motor in metres/second and newtons.
Definition Joint3D.cpp:215
void setSphericalConeLimit(bool enabled, float angle)
Enables a spherical cone limit in radians, within [0, pi].
Definition Joint3D.cpp:236
void setWeldAngularSpring(float hertz, float dampingRatio)
Configures weld angular spring stiffness and damping; 0 hertz is rigid.
Definition Joint3D.cpp:345
int getBodyBId() const
Stable ID of attached body B, or -1 after invalidation.
Definition Joint3D.cpp:70
void setWheelSuspension(bool enabled, float hertz, float dampingRatio)
Configures wheel suspension spring stiffness and damping.
Definition Joint3D.cpp:274
void setPrismaticSpring(bool enabled, float targetTranslation, float hertz, float dampingRatio)
Configures a prismatic linear spring and target translation.
Definition Joint3D.cpp:195
float getConstraintTorqueY() const
Current world-space constraint torque Y in newton-metres.
float getSphericalTwistAngle() const
Current spherical twist angle in radians.
Definition Joint3D.cpp:269
void setCollideConnected(bool collide)
Enables or disables collision between the attached bodies.
Definition Joint3D.cpp:72
void setMotorLinearSpring(float hertz, float dampingRatio, float maxForce)
Configures motor linear position spring.
Definition Joint3D.cpp:390
Joint2D * getSliderJoint() const
Frame-to-slider prismatic, or null for shaft/ratchet.
Definition Mechanism2D.h:74
float getRatchetEngagementTorque() const
Current ratchet engagement torque in newton-metres.
Definition Mechanism2D.h:101
void setRatchetDirection(int direction)
Sets ratchet freewheel direction (+1 or -1).
Definition Mechanism2D.cpp:89
std::string getKind() const
Kind name: "crankSlider", "shaft", or "ratchet".
Definition Mechanism2D.cpp:27
int getRatchetDirection() const
Current ratchet freewheel direction (+1 or -1).
Definition Mechanism2D.h:97
void setRatchetEngagementTorque(float torque)
Sets reverse-lock torque for ratchet engagement.
Definition Mechanism2D.cpp:96
Joint2D * getDriveJoint() const
Primary revolute (crank / shaft / ratchet wheel).
Definition Mechanism2D.h:53
float getSliderTranslation() const
Current slider translation in pixels (crank-slider only).
Definition Mechanism2D.cpp:55
Joint2D * getCrankPinJoint() const
Crank-to-rod revolute, or null for shaft/ratchet.
Definition Mechanism2D.h:60
void setDrive(float speed, float maxTorque)
Enables a continuous drive motor on the primary revolute.
Definition Mechanism2D.cpp:70
bool isValid() const
Whether the assembly and its primary joints are still live.
Definition Mechanism2D.cpp:36
Joint2D * getSliderPinJoint() const
Rod-to-slider revolute, or null for shaft/ratchet.
Definition Mechanism2D.h:67
bool isDriveEnabled() const
Whether a continuous drive motor is configured.
Definition Mechanism2D.h:92
Joint3D * getCrankPinJoint() const
Crank-to-rod revolute, or null for shaft/ratchet.
Definition Mechanism3D.h:55
float getSliderTranslation() const
Current slider translation in metres (crank-slider only).
Definition Mechanism3D.cpp:58
void setRatchetEngagementTorque(float torque)
Sets reverse-lock torque for ratchet engagement.
Definition Mechanism3D.cpp:109
void setRatchetDirection(int direction)
Sets ratchet freewheel direction.
Definition Mechanism3D.cpp:102
float getDriveAngle() const
Current drive revolute angle in radians (shaft/crank/ratchet).
Definition Mechanism3D.cpp:53
void setDrive(float speed, float maxTorque)
Enables a continuous drive motor on the primary revolute.
Definition Mechanism3D.cpp:79
Joint3D * getSliderPinJoint() const
Rod-to-slider revolute, or null for shaft/ratchet.
Definition Mechanism3D.h:62
bool isValid() const
Whether the assembly and its primary joints are still live.
Definition Mechanism3D.cpp:39
int getRatchetDirection() const
Current ratchet freewheel direction (+1 or -1).
Definition Mechanism3D.h:96
std::string getKind() const
Kind name: "crankSlider", "shaft", or "ratchet".
Definition Mechanism3D.cpp:30
float getRatchetEngagementTorque() const
Current ratchet engagement torque in newton-metres.
Definition Mechanism3D.h:103
bool isDriveEnabled() const
Whether a continuous drive motor is configured.
Definition Mechanism3D.h:88
Joint3D * getDriveJoint() const
Primary revolute (crank / shaft / ratchet wheel).
Definition Mechanism3D.h:48
Joint3D * getSliderJoint() const
Frame-to-slider prismatic, or null for shaft/ratchet.
Definition Mechanism3D.h:69
float getSpinSpeed() const
Relative spin speed along the drive axis in radians/second.
Definition Mechanism3D.cpp:74
Physics module — Box2D (2D) + Box3D (3D) rigid bodies and SPH fluid. Script: physics <- eve....
Definition Physics.h:22
DistanceField3D * newDistanceField3D(int width, int height, int depth, float cellSize, float originX=0.f, float originY=0.f, float originZ=0.f, float outsideDistance=1e6f)
Create a regular 3D signed-distance grid for map collision queries.
Definition Physics.cpp:49
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:45
void setMeter(float pixelsPerMeter)
Pixels per meter for 2D Box2D worlds (default 30, same as LÖVE).
Definition Physics.cpp:33
SoftBody3DRenderer * newSoftBody3DRenderer(SoftBody3D *body)
Create a presentation satellite observing a soft-body runtime.
Definition Physics.cpp:63
Fluid2D * newFluid2D(int capacity=512)
Creates an interactive 2D particle fluid in pixel space.
Definition Physics.cpp:67
World * newWorld(float gravityX, float gravityY, bool sleep=true)
Create a 2D Box2D physics world.
Definition Physics.cpp:41
SoftBody3D * newSoftBody3D(int cols, int rows, int layers, float spacing, float originX, float originY, float originZ)
Compatibility factory for a volumetric shape-matching soft body.
Definition Physics.cpp:56
int getId() const
Stable world-local id, preserved when sensor state recreates the backend shape.
Definition Shape3D.h:44
float getHeightFieldCellSizeZ() const
Height-field cell spacing along local Z, or zero.
Definition Shape3D.h:149
void setLocalPosition(float x, float y, float z)
Sets local translation while preserving local rotation.
Definition Shape3D.cpp:764
void setTag(int tag)
User-defined integer tag preserved for the wrapper lifetime.
Definition Shape3D.cpp:383
void setBoxSize(float width, float height, float depth)
Atomically changes full box dimensions in meters.
Definition Shape3D.cpp:469
int getHeightFieldCountZ() const
Height-field sample count along local Z, or zero.
Definition Shape3D.h:143
float getTriangleMeshMaterialRestitution(int slot) const
Restitution of a triangle-mesh material slot.
Definition Shape3D.cpp:659
int getTriangleMeshMaterialId(int slot) const
Application material ID of a triangle-mesh material slot.
Definition Shape3D.cpp:673
void setOneWay(float nx, float ny, float nz, float planeOffset, float margin, float minNormalDot)
Enables a one-way collision plane in shape-local space.
Definition Shape3D.cpp:398
int getTriangleMeshVertexCount() const
Source vertex count for a triangle mesh, or zero.
Definition Shape3D.h:94
std::string getKind() const
Kind name including primitives, "convexHull", "triangleMesh", or "heightField".
Definition Shape3D.cpp:457
bool testPoint(float x, float y, float z) const
Point-in-shape test in world meters.
Definition Shape3D.cpp:932
void setHitEventsEnabled(bool enabled)
Enables significant collision hit events for this shape.
Definition Shape3D.cpp:388
void setMaterialId(int id)
Sets a low-32-bit application material identifier exposed by native queries.
Definition Shape3D.cpp:829
int getTriangleMeshMaterialIndex(int triangleIndex) const
Material-slot index assigned to a source triangle.
Definition Shape3D.cpp:608
void setTriangleMeshMaterial(int slot, float friction, float restitution, float rollingResistance, float tangentX, float tangentY, float tangentZ, int materialId, const std::string &frictionMode, const std::string &restitutionMode)
Replaces one triangle-mesh material slot without rebuilding geometry.
Definition Shape3D.cpp:622
float getHeightFieldHeight(int x, int z) const
Source height at a grid sample.
Definition Shape3D.cpp:719
int getTriangleMeshMaterialCount() const
Number of material slots on a triangle mesh, otherwise zero.
Definition Shape3D.cpp:618
float getTangentVelocityY() const
Local-space conveyor velocity Y component.
Definition Shape3D.cpp:821
float getTriangleMeshMaterialRollingResistance(int slot) const
Rolling resistance of a triangle-mesh material slot.
Definition Shape3D.cpp:665
void setRestitution(float restitution)
Definition Shape3D.cpp:783
void setSphereRadius(float radius)
Atomically changes sphere radius in meters.
Definition Shape3D.cpp:488
float getBoxHeight() const
Full box height, or zero for another geometry kind.
Definition Shape3D.h:163
void setLocalTransform(float px, float py, float pz, float qx, float qy, float qz, float qw)
Atomically sets the shape transform relative to its Body3D.
Definition Shape3D.cpp:728
void setGroupIndex(int index)
Collision group; negative never collides, positive always collides.
Definition Shape3D.cpp:921
float getTriangleMeshMaterialFriction(int slot) const
Friction of a triangle-mesh material slot.
Definition Shape3D.cpp:653
float getHeightFieldGlobalMin() const
Height-field shared quantization minimum, or zero.
Definition Shape3D.h:153
void setFrictionCombineMode(const std::string &mode)
Sets friction combine mode: default, average, minimum, multiply, or maximum.
Definition Shape3D.cpp:837
void setLocalRotation(float qx, float qy, float qz, float qw)
Sets local rotation while preserving local translation.
Definition Shape3D.cpp:768
void setTangentVelocity(float x, float y, float z)
Sets local-space conveyor velocity projected onto contact surfaces.
Definition Shape3D.cpp:808
float getExplosionScale() const
Current explosion impulse multiplier; zero opts this shape out.
Definition Shape3D.h:249
float getCapsuleHeight() const
Capsule hemisphere-center distance, or zero for another kind.
Definition Shape3D.h:171
int getHeightFieldCountX() const
Height-field sample count along local X, or zero.
Definition Shape3D.h:141
void setCapsuleSize(float height, float radius)
Atomically changes capsule segment height and radius in meters.
Definition Shape3D.cpp:501
float getHeightFieldCellSizeX() const
Height-field cell spacing along local X, or zero.
Definition Shape3D.h:145
float getHeightFieldGlobalMax() const
Height-field shared quantization maximum, or zero.
Definition Shape3D.h:157
void setRestitutionCombineMode(const std::string &mode)
Sets restitution combine mode: default, average, minimum, multiply, or maximum.
Definition Shape3D.cpp:852
float getTangentVelocityZ() const
Local-space conveyor velocity Z component.
Definition Shape3D.cpp:825
int getTriangleMeshTriangleCount() const
Source triangle count for a triangle mesh, or zero.
Definition Shape3D.h:98
std::string getRestitutionCombineMode() const
Current restitution combine mode.
Definition Shape3D.cpp:861
void setRollingResistance(float resistance)
Rolling resistance coefficient, finite and non-negative.
Definition Shape3D.cpp:794
void disableOneWay()
Disables one-way filtering and restores ordinary two-sided collision.
Definition Shape3D.cpp:422
void setSensor(bool sensor)
Sensor shapes report contacts but never collide.
Definition Shape3D.cpp:371
int getConvexHullPointCount() const
Source point count for a convex hull, or zero for another kind.
Definition Shape3D.h:78
bool areHitEventsEnabled() const
Whether significant collision hit events are enabled.
Definition Shape3D.cpp:394
void setExplosionScale(float scale)
Sets non-negative multiplier applied to geometry-aware explosion impulses.
Definition Shape3D.cpp:874
int getConvexHullMaxVertices() const
Current convex-hull simplification budget, or zero for another kind.
Definition Shape3D.h:82
float getTangentVelocityX() const
Local-space conveyor velocity X component.
Definition Shape3D.cpp:817
float getRollingResistance() const
Current rolling resistance; physically affects spheres and capsules.
Definition Shape3D.cpp:804
Presentation-only renderer for a borrowed volumetric soft body.
Definition SoftBody3DRenderer.h:21
void draw(graphics::Graphics *graphics)
Update the surface cache and draw it in the current 3D frame.
Definition SoftBody3DGraphics.cpp:29
void setBody(SoftBody3D *body)
Replace the borrowed runtime; null disables drawing.
Definition SoftBody3DGraphics.cpp:15
void setColor(float r, float g, float b, float a)
Set the clamped RGBA presentation color.
Definition SoftBody3DGraphics.cpp:22
Volumetric particle soft body using overlapping shape-matching clusters.
Definition SoftBody3D.h:27
void update(float dt)
Advances using a legacy variable timestep clamped to 50 ms.
Definition SoftBody3D.cpp:406
void setBounds(float x, float y, float z, float width, float height, float depth)
Sets the bounds.
Definition SoftBody3D.cpp:151
float getParticleZ(int index) const
Definition SoftBody3D.cpp:228
void setDeformationResistance(float value)
Sets the deformation resistance.
Definition SoftBody3D.cpp:124
void setCollideWorld(World3D *world)
Borrows a rigid-body world used for particle contacts.
Definition SoftBody3DWorldBridge.cpp:69
float getVolumeRatio() const
Returns current cell volume divided by undeformed rest volume.
Definition SoftBody3D.cpp:453
void setPlasticity(float yield, float creep, float recovery, float maxDeformation)
Sets the plasticity.
Definition SoftBody3D.cpp:138
void setParticlePosition(int index, float x, float y, float z)
Definition SoftBody3D.cpp:232
float getDeformationResistance() const
Returns the deformation resistance.
Definition SoftBody3D.cpp:126
static eve::Result< std::unique_ptr< SoftBody3D > > create(const SoftBody3DDefinition &definition)
Creates a soft body from the canonical versioned definition.
Definition SoftBody3D.cpp:52
void interactAt(float x, float y, float z, float radius, float strength)
Interact at.
Definition SoftBody3D.cpp:211
float getParticleX(int index) const
Definition SoftBody3D.cpp:220
float getParticleY(int index) const
Definition SoftBody3D.cpp:224
Caller-owned state for Pcg-style rigid-body activation after terrain loading.
Definition TerrainLoadGravity.h:11
bool isCompleted() const
Whether gravity restoration and the activation notification completed.
Definition TerrainLoadGravity.h:18
bool isMonitoring() const
Whether a containing terrain was found and activation is being monitored.
Definition TerrainLoadGravity.h:14
bool isActivationScheduled() const
Whether the post-load delay has been scheduled.
Definition TerrainLoadGravity.h:16
float getDelayElapsed() const
Elapsed seconds since the first loaded observation.
Definition TerrainLoadGravity.h:20
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:63
bool hasClosestPoint() const
Whether the latest closestPoint call found a shape.
Definition World3D.h:655
int getBeginTriggerVisitorShapeId(int index) const
Visitor shape ID of a begin-trigger event.
float getProfileStepMs() const
Latest complete physics step time in milliseconds.
float getRestitutionThreshold() const
Current restitution speed threshold in m/s.
Definition World3D.cpp:235
int getBeginContactShapeAId(int index) const
Shape ID on stable side A of a begin-contact event.
float getShapeCastX() const
World-space contact point X from the last shape cast.
Definition World3D.h:690
int getEndTriggerCount() const
Number of sensor overlaps that ended during the latest step.
Definition World3D.h:828
float getJointStressForceY(int index) const
Constraint force Y of a stress event.
int getClosestShapeId() const
Stable shape id from the latest closestPoint call, or -1.
Definition World3D.h:659
float getContactPointTotalNormalImpulse(int index) const
Total normal impulse accumulated across all physics substeps.
int getRayHitTriangleIndex() const
Mesh/height-field triangle index from the last ray cast, otherwise -1.
Definition World3D.h:523
float getHitNormalX(int index) const
Hit normal X, pointing from stable side A to B.
int getDynamicTreeHeight() const
Dynamic broad-phase tree height.
int castSphere(float x, float y, float z, float radius, float dx, float dy, float dz)
Sweep a sphere through the world and return the earliest hit body id, or -1.
Definition World3D.cpp:1788
bool isWarmStartingEnabled() const
Whether constraint warm starting is enabled.
Definition World3D.cpp:276
int getShapeCastResultShapeId(int index) const
Shape ID of a sorted Shape Cast result.
float getMaximumLinearSpeed() const
Current world-wide maximum linear speed in m/s.
Definition World3D.cpp:268
int getBeginTriggerSensorBodyId(int index) const
Sensor body ID of a begin-trigger event.
Joint3D * newMotorJoint(Body3D *bodyA, Body3D *bodyB, bool collideConnected=false)
Creates a motor joint that drives relative linear/angular velocity between bodies.
Definition World3DJoints.cpp:61
float getContactPushOutSpeed() const
Current maximum contact push-out speed in m/s.
Definition World3D.h:222
int queryCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius)
Query shapes overlapping an arbitrarily oriented capsule. The endpoints are the centers of its hemisp...
Definition World3D.cpp:1636
float getContactPointNormalImpulse(int index) const
Normal impulse from the final physics substep.
int getEndContactShapeBId(int index) const
Shape ID on stable side B of an end-contact event.
void update(float dt)
Steps the simulation by dt seconds (default substep count).
Definition World3D.cpp:726
int closestPoint(float x, float y, float z, float maxDistance)
Find the closest collision surface within maxDistance of a world point. Uses the current query catego...
Definition World3D.cpp:1838
float getShapeCastResultFraction(int index) const
Translation fraction in [0,1] of a Shape Cast result.
int getClosestShapeTag() const
User tag of the shape from the latest closestPoint call, or zero.
Definition World3D.h:661
int getEndContactBodyAId(int index) const
Body ID on stable side A of an end-contact event.
int getEndContactShapeATag(int index) const
Shape Tag on stable side A of an end-contact event.
int getShapeCastShapeId() const
Stable shape id from the last shape cast, or -1.
Definition World3D.h:682
int getRayResultTriangleIndex(int index) const
Mesh/height-field triangle index of a sorted ray result, otherwise -1.
float getShapeCastZ() const
World-space contact point Z from the last shape cast.
Definition World3D.h:694
float getContactPointX(int index) const
World-space contact point X on the queried body.
int castBox(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw, float dx, float dy, float dz)
Sweep an oriented box without changing its rotation.
Definition World3D.cpp:1820
int getBeginContactBodyBId(int index) const
Body ID on stable side B of a begin-contact event.
int getContactPointOtherShapeId(int index) const
Other Shape ID of a contact point.
float getMoverNormalY() const
Representative blocking normal Y from the last move.
Definition World3D.h:757
int getQueryShapeCount() const
Number of individual shapes hit by the last overlap query.
Definition World3D.h:778
Joint3D * newWeldJoint(Body3D *bodyA, Body3D *bodyB, float anchorX, float anchorY, float anchorZ, bool collideConnected=false)
Welds two bodies at a shared world-space anchor, preserving current relative pose.
Definition World3DJoints.cpp:36
float getBoundsMinZ() const
Minimum world-space Z covered by current broad-phase bounds.
Definition World3D.cpp:360
float getExplosionResultDeltaVelocityX(int index) const
Explosion-induced linear velocity delta X.
int getQueryShapeId(int index) const
Stable shape id of the i-th shape hit, sorted ascending.
Definition World3D.cpp:2182
float getRayResultNormalY(int index) const
Surface normal Y of a sorted ray result.
float getProfileBulletsMs() const
Latest continuous-collision bullet time in milliseconds.
void setBodyPairCollisionEnabled(Body3D *bodyA, Body3D *bodyB, bool enabled)
Overrides collision for a live body pair without changing layer masks.
Definition World3D.cpp:810
float getContactPointSeparation(int index) const
Signed surface separation; negative values indicate penetration.
int getHitShapeBId(int index) const
Stable Shape ID on side B of a hit.
float getClosestNormalX() const
Surface-to-target normal X, or zero for an inside/on-surface target.
Definition World3D.h:669
int getQueryShapeTag(int index) const
User tag paired with the i-th shape hit.
Definition World3D.cpp:2188
Joint3D * newParallelJoint(Body3D *bodyA, Body3D *bodyB, float axisX, float axisY, float axisZ, bool collideConnected=false)
Creates a parallel joint that spring-aligns body local Z axes to a world axis.
Definition World3DJoints.cpp:76
float getMoverDeltaZ() const
Resolved translation Z from the last moveCapsule call.
Definition World3D.h:753
float getProfileCollideMs() const
Latest narrow-phase collision time in milliseconds.
void setMoverUp(float x, float y, float z)
Set the up direction used for grounded and slope classification.
Definition World3D.cpp:1918
int getHitCount() const
Number of significant collision hits generated during the latest step.
Definition World3D.h:887
Joint3D * newSphericalJoint(Body3D *bodyA, Body3D *bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected=false)
Creates a ball-and-socket joint with a world-space twist/cone axis.
Definition World3D.cpp:632
int getJointStressKind(int index) const
Joint kind code: 0 distance, 1 revolute, 2 prismatic, 3 spherical, 4 wheel.
int getShapeCastShapeTag() const
User tag of the shape from the last shape cast, or zero on no hit.
Definition World3D.h:684
Joint3D * newRevoluteJoint(Body3D *bodyA, Body3D *bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected=false)
Creates a hinge around a normalized world-space axis at a shared anchor.
Definition World3D.cpp:562
float getMoverDeltaY() const
Resolved translation Y from the last moveCapsule call.
Definition World3D.h:751
int getBeginTriggerCount() const
Number of sensor overlaps that began during the latest step.
Definition World3D.h:814
void setContactTuning(float hertz, float dampingRatio, float pushOutSpeed)
Configures contact overlap recovery.
Definition World3D.cpp:239
bool isBodyPairCollisionEnabled(Body3D *bodyA, Body3D *bodyB) const
Whether a body pair is permitted by the runtime contact override.
Definition World3D.cpp:827
int queryBodyContacts(int bodyId, int maxPoints)
Caches current touching manifold points for one stable Body3D ID. Results are oriented from the queri...
Definition World3D.cpp:1096
void setQueryIgnoredBodyId(int bodyId)
Ignores one stable Body3D ID in subsequent spatial queries; -1 disables.
Definition World3D.cpp:980
int getExplosionResultBodyId(int index) const
Stable Body ID of an affected body, sorted ascending.
int castCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy, float dz)
Sweep an arbitrarily oriented capsule through the world. The endpoints are cap centers and d{x,...
Definition World3D.cpp:1803
float getMoverNormalZ() const
Representative blocking normal Z from the last move.
Definition World3D.h:759
int getBeginTriggerVisitorShapeTag(int index) const
Visitor Shape Tag of a begin-trigger event.
int getEndContactShapeBTag(int index) const
Shape Tag on stable side B of an end-contact event.
float getClosestDistance() const
Non-negative distance from the target to the closest shape.
Definition World3D.h:675
int getHitBodyBId(int index) const
Stable body ID on side B of a hit.
bool isContinuousCollisionEnabled() const
Whether world-level continuous collision is enabled.
Definition World3D.cpp:225
int getContactPointShapeTag(int index) const
Queried-body Shape Tag of a contact point.
float getHitNormalImpulse(int index) const
Total normal impulse accumulated across all manifolds and substeps.
int querySphere(float x, float y, float z, float radius)
Query shapes overlapping a sphere in world meters.
Definition World3D.cpp:1627
int getHitShapeAId(int index) const
Stable Shape ID on side A of a hit.
void setWarmStartingEnabled(bool enabled)
Enables constraint warm starting for stable stacks and joints.
Definition World3D.cpp:272
float getContactPointY(int index) const
World-space contact point Y on the queried body.
float getContactPointNormalY(int index) const
Contact normal Y from queried body toward the other body.
int getBeginContactCount() const
Number of non-sensor contacts that began during the latest step.
Definition World3D.h:785
int getJointStressBodyAId(int index) const
Stable body A ID of a stress event.
float getShapeCastResultNormalZ(int index) const
Contact normal Z of a Shape Cast result.
int getEndContactCount() const
Number of non-sensor contacts that ended during the latest step.
Definition World3D.h:799
int getRayResultShapeId(int index) const
Shape ID of a sorted ray result.
bool isShapePairCollisionEnabled(Shape3D *shapeA, Shape3D *shapeB) const
Whether a shape pair is permitted by the runtime contact override.
Definition World3D.cpp:849
int castCapsuleAll(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-capsule intersections.
Definition World3D.cpp:1809
int getBeginTriggerSensorShapeId(int index) const
Sensor shape ID of a begin-trigger event.
int rayCast(float x1, float y1, float z1, float x2, float y2, float z2)
Closest raycast from (x1,y1,z1) to (x2,y2,z2) in meters. Returns hit body id, or -1....
Definition World3D.cpp:1332
int getJointStressCount() const
Number of joints exceeding force/torque thresholds in the latest step.
Definition World3D.h:917
float getShapeCastResultY(int index) const
World-space contact point Y of a Shape Cast result.
int explode(float x, float y, float z, float radius, float falloff, float impulsePerArea, int maskBits=-1)
Applies a geometry-aware radial impulse to dynamic convex shapes.
Definition World3D.cpp:280
int getShapeCastTriangleIndex() const
Mesh/height-field triangle index from the latest shape cast, otherwise -1.
Definition World3D.h:688
void setQueryFilter(int categoryBits, int maskBits)
Set category/mask bits for subsequent ray, overlap, cast and mover queries.
Definition World3D.cpp:970
float getMoverDeltaX() const
Resolved translation X from the last moveCapsule call.
Definition World3D.h:749
int getShapeCastMaterialId() const
Surface material ID at the last shape-cast intersection, or zero.
Definition World3D.h:686
float getRayResultFraction(int index) const
Segment fraction in [0,1] of a sorted ray result.
float getBoundsMaxZ() const
Maximum world-space Z covered by current broad-phase bounds.
Definition World3D.cpp:369
int getEndTriggerSensorShapeTag(int index) const
Sensor Shape Tag of an end-trigger event.
void setMoverSlopeLimit(float degrees)
Set maximum walkable slope in degrees, clamped to [0, 89.9].
Definition World3D.cpp:1928
void setHitEventThreshold(float speed)
Minimum approach speed in m/s required for enabled Shape3D hit events.
Definition World3D.cpp:795
int getBeginContactShapeATag(int index) const
Shape Tag on stable side A of a begin-contact event.
int castBoxAll(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-oriented-box intersections.
Definition World3D.cpp:1826
int getStaticTreeHeight() const
Static broad-phase tree height.
int getContactPointOtherBodyId(int index) const
Other Body ID of a contact point.
int getEndTriggerSensorShapeId(int index) const
Sensor shape ID of an end-trigger event.
Mechanism3D * newCrankSlider(Body3D *frame, Body3D *crank, Body3D *rod, Body3D *slider, float crankAnchorX, float crankAnchorY, float crankAnchorZ, float axisX, float axisY, float axisZ, float crankPinX, float crankPinY, float crankPinZ, float sliderPinX, float sliderPinY, float sliderPinZ, float slideAxisX, float slideAxisY, float slideAxisZ, bool collideConnected=false)
Builds a planar crank-slider from frame, crank, connecting rod and slider bodies.
Definition World3DJoints.cpp:155
float getShapeCastResultNormalX(int index) const
Contact normal X of a Shape Cast result.
int getClosestBodyId() const
Stable body id from the latest closestPoint call, or -1.
Definition World3D.h:657
float getContactPointZ(int index) const
World-space contact point Z on the queried body.
int getBeginContactShapeBTag(int index) const
Shape Tag on stable side B of a begin-contact event.
float getExplosionResultDeltaAngularVelocityY(int index) const
Explosion-induced angular velocity delta Y.
float getExplosionResultDeltaVelocityY(int index) const
Explosion-induced linear velocity delta Y.
float getRayResultX(int index) const
World-space hit point X of a sorted ray result.
int getMemoryByteCount() const
Approximate Box3D world allocation in bytes.
int getEndTriggerVisitorShapeId(int index) const
Visitor shape ID of an end-trigger event.
int getQueryIgnoredShapeId() const
Stable Shape3D ID currently ignored by queries, or -1.
Definition World3D.h:953
int getEndTriggerVisitorShapeTag(int index) const
Visitor Shape Tag of an end-trigger event.
int getShapeCastBodyId() const
Stable body id from the last shape cast, or -1.
Definition World3D.h:680
float getShapeCastY() const
World-space contact point Y from the last shape cast.
Definition World3D.h:692
int getContactPointShapeId(int index) const
Queried-body Shape ID of a contact point.
float getExplosionResultDeltaAngularVelocityX(int index) const
Explosion-induced angular velocity delta X.
float getShapeCastResultX(int index) const
World-space contact point X of a Shape Cast result.
int queryBox(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw)
Query shapes overlapping an oriented box.
Definition World3D.cpp:1692
void setMaximumLinearSpeed(float speed)
Sets the finite positive world-wide linear velocity clamp in m/s.
Definition World3D.cpp:262
float getBoundsMinY() const
Minimum world-space Y covered by current broad-phase bounds.
Definition World3D.cpp:357
int getRayHitMaterialId() const
Surface material ID at the last ray intersection, or zero.
Definition World3D.h:521
Mechanism3D * newRatchet(Body3D *frame, Body3D *wheel, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, int direction, float engagementTorque, bool collideConnected=false)
Builds a one-way ratchet around a revolute axis.
Definition World3DJoints.cpp:136
float getJointStressForceZ(int index) const
Constraint force Z of a stress event.
int getShapeCastResultTriangleIndex(int index) const
Mesh/height-field triangle index of a Shape Cast result, otherwise -1.
float getClosestNormalZ() const
Surface-to-target normal Z, or zero for an inside/on-surface target.
Definition World3D.h:673
Joint3D * newFilterJoint(Body3D *bodyA, Body3D *bodyB)
Disables collision between two specific bodies (filter joint).
Definition World3DJoints.cpp:100
int getExplosionResultCount() const
Number of bodies affected by the latest explosion.
Definition World3D.h:249
float getShapeCastResultZ(int index) const
World-space contact point Z of a Shape Cast result.
int getRayHitShapeTag() const
User tag of the shape from the last ray cast, or zero on no hit.
Definition World3D.h:519
Joint3D * newPrismaticJoint(Body3D *bodyA, Body3D *bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected=false)
Creates a slider whose permitted world-space translation follows axis.
Definition World3D.cpp:597
float getProfileSensorsMs() const
Latest sensor processing time in milliseconds.
Mechanism3D * newShaft(Body3D *support, Body3D *rotor, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected=false)
Builds a shaft (support↔rotor revolute) with optional drive motor helpers.
Definition World3DJoints.cpp:122
float getBoundsMinX() const
Minimum world-space X covered by current broad-phase bounds.
Definition World3D.cpp:354
int getAwakeContactCount() const
Contacts processed by the latest collide pass.
int getHitShapeBTag(int index) const
Shape Tag on side B of a hit.
float getClosestNormalY() const
Surface-to-target normal Y, or zero for an inside/on-surface target.
Definition World3D.h:671
Joint3D * newWheelJoint(Body3D *bodyA, Body3D *bodyB, float anchorX, float anchorY, float anchorZ, float suspensionAxisX, float suspensionAxisY, float suspensionAxisZ, float wheelAxisX, float wheelAxisY, float wheelAxisZ, bool collideConnected=false)
Creates a vehicle wheel joint with independent world suspension and spin axes.
Definition World3D.cpp:667
void setRestitutionThreshold(float speed)
Minimum impact speed that permits material restitution, in m/s.
Definition World3D.cpp:229
Joint3D * newDistanceJoint(Body3D *bodyA, Body3D *bodyB, float anchorAX, float anchorAY, float anchorAZ, float anchorBX, float anchorBY, float anchorBZ, float length, bool collideConnected=false)
Connects two world-space anchor points with a rigid distance constraint.
Definition World3D.cpp:532
float getContactRecycleDistance() const
Current contact-point persistence distance in meters.
Definition World3D.cpp:258
int getHitBodyAId(int index) const
Stable body ID on side A of a hit.
float getJointStressForceX(int index) const
Constraint force X of a stress event.
int queryAABB(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
Query shapes overlapping an AABB in meters (min/max corners). Returns match count; read ids with getQ...
Definition World3D.cpp:1502
float getContactPointNormalVelocity(int index) const
Pre-solve relative normal velocity; negative means approaching.
void updateFull(float dt, int subStepCount)
Steps with an explicit substep count.
Definition World3D.cpp:728
int castSphereAll(float x, float y, float z, float radius, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-sphere intersections.
Definition World3D.cpp:1793
int getRayResultShapeTag(int index) const
Shape Tag of a sorted ray result.
int getShapeCastResultShapeTag(int index) const
Shape Tag of a sorted Shape Cast result.
void setContinuousCollisionEnabled(bool enabled)
Enables world-level continuous collision against static geometry.
Definition World3D.cpp:221
void setQueryIgnoredShapeId(int shapeId)
Ignores one stable Shape3D ID in subsequent spatial queries; -1 disables.
Definition World3D.cpp:986
float getShapeCastFraction() const
Translation fraction in [0,1] at the earliest hit.
Definition World3D.h:702
void clearQueryIgnores()
Clears Body and Shape query exclusions without changing layer filtering.
Definition World3D.cpp:992
float getBoundsMaxX() const
Maximum world-space X covered by current broad-phase bounds.
Definition World3D.cpp:363
int getBeginContactShapeBId(int index) const
Shape ID on stable side B of a begin-contact event.
int getEndTriggerSensorBodyId(int index) const
Sensor body ID of an end-trigger event.
int getEndTriggerVisitorBodyId(int index) const
Visitor body ID of an end-trigger event.
int getQueryIgnoredBodyId() const
Stable Body3D ID currently ignored by queries, or -1.
Definition World3D.h:951
int getContactPointCount() const
Number of points cached by queryBodyContacts.
Definition World3D.h:852
float getExplosionResultDeltaAngularVelocityZ(int index) const
Explosion-induced angular velocity delta Z.
float getRayResultNormalX(int index) const
Surface normal X of a sorted ray result.
float getShapeCastResultNormalY(int index) const
Contact normal Y of a Shape Cast result.
float getProfileSolveMs() const
Latest constraint solver time in milliseconds.
void clearContactEvents()
Clears all contact and trigger buffers before the next step.
Definition World3D.cpp:1086
int getJointStressBodyBId(int index) const
Stable body B ID of a stress event.
int getEndContactShapeAId(int index) const
Shape ID on stable side A of an end-contact event.
float getContactPointNormalX(int index) const
Contact normal X from queried body toward the other body.
float getHitNormalY(int index) const
Hit normal Y, pointing from stable side A to B.
float getProfilePairsMs() const
Latest broad-phase pair generation time in milliseconds.
float getHitApproachSpeed(int index) const
Positive pre-solve approach speed in m/s.
bool hasShapeCastHit() const
Whether the last sphere, capsule, or box cast hit a body.
Definition World3D.h:678
void resetQueryFilter()
Restore the query filter to accept all lower-32-bit categories.
Definition World3D.cpp:975
void setShapePairCollisionEnabled(Shape3D *shapeA, Shape3D *shapeB, bool enabled)
Overrides collision for one live shape pair.
Definition World3D.cpp:835
bool isContactPointPersisted(int index) const
Whether this manifold point existed in the previous step.
Definition World3D.cpp:2339
float getMoverNormalX() const
Representative blocking normal X from the last move.
Definition World3D.h:755
float getHitEventThreshold() const
Current significant-hit speed threshold in m/s.
Definition World3D.cpp:801
int getRecycledContactCount() const
Contact points recycled during the latest step.
int getShapeCastResultMaterialId(int index) const
Surface material ID at a sorted Shape Cast intersection.
int getEndContactBodyBId(int index) const
Body ID on stable side B of an end-contact event.
int getRayResultCount() const
Number of results cached by the latest rayCast or rayCastAll call.
Definition World3D.h:532
float getExplosionResultDeltaVelocityZ(int index) const
Explosion-induced linear velocity delta Z.
int rayCastAll(float x1, float y1, float z1, float x2, float y2, float z2, int maxHits)
Collects the nearest maxHits ray intersections, sorted by fraction then Shape ID.
Definition World3D.cpp:1405
Body3D * newBody(const std::string &bodyType, float x, float y, float z)
Creates a body in meter-space units.
Definition World3D.cpp:902
float getHitNormalZ(int index) const
Hit normal Z, pointing from stable side A to B.
int getBeginTriggerSensorShapeTag(int index) const
Sensor Shape Tag of a begin-trigger event.
float getBoundsMaxY() const
Maximum world-space Y covered by current broad-phase bounds.
Definition World3D.cpp:366
void setContactRecycleDistance(float distance)
Sets contact-point persistence distance in meters; zero disables recycling.
Definition World3D.cpp:252
float getRayResultNormalZ(int index) const
Surface normal Z of a sorted ray result.
int getShapeCastResultBodyId(int index) const
Body ID of a sorted Shape Cast result.
int getHitShapeATag(int index) const
Shape Tag on side A of a hit.
bool moveCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy, float dz)
Move a capsule with continuous collision and multi-plane sliding. Existing penetration is recovered b...
Definition World3D.cpp:1935
float getJointStressTorqueY(int index) const
Constraint torque Y of a stress event.
int getJointStressJointId(int index) const
Stable Joint3D ID of a stress event.
int getBeginContactBodyAId(int index) const
Body ID on stable side A of a begin-contact event.
int getBeginTriggerVisitorBodyId(int index) const
Visitor body ID of a begin-trigger event.
float getJointStressTorqueZ(int index) const
Constraint torque Z of a stress event.
int getMoverIterations() const
Number of outer solver passes used by the last move.
Definition World3D.h:763
float getRayResultY(int index) const
World-space hit point Y of a sorted ray result.
int getShapeCastResultCount() const
Number of results cached by the latest single or multi Shape Cast.
Definition World3D.h:704
int getMoverPlaneCount() const
Number of collision planes considered during the last move.
Definition World3D.h:761
float getJointStressTorqueX(int index) const
Constraint torque X of a stress event.
int getContactPointOtherShapeTag(int index) const
Other Shape Tag of a contact point.
int getRayResultBodyId(int index) const
Body ID of a sorted ray result.
int getRayResultMaterialId(int index) const
Surface material ID at a sorted ray intersection.
float getContactPointNormalZ(int index) const
Contact normal Z from queried body toward the other body.
float getMoverGroundDot() const
Largest dot product between mover up and a contact normal.
Definition World3D.h:771
bool isMoverGrounded() const
True when the last move touched a walkable plane.
Definition World3D.h:769
float getRayResultZ(int index) const
World-space hit point Z of a sorted ray result.
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
Definition World.h:41
Joint2D * newDistanceJoint(Body *bodyA, Body *bodyB, float anchorAX, float anchorAY, float anchorBX, float anchorBY, float lengthPixels, bool collideConnected=false)
Connects two pixel-space anchors with a distance constraint.
Definition WorldJoints2D.cpp:79
Joint2D * newWheelJoint(Body *bodyA, Body *bodyB, float anchorX, float anchorY, float axisX, float axisY, bool collideConnected=false)
Creates a wheel joint with a pixel-space suspension axis.
Definition WorldJoints2D.cpp:131
void update(float dt)
Steps the simulation by dt seconds (5 velocity / 2 position iterations).
Definition World.cpp:354
int queryAABB(float x, float y, float w, float h)
Query fixtures overlapping an axis-aligned box in pixel space (x,y,w,h). Returns match count; read id...
Definition World.cpp:695
float getImpactNormalY(int index) const
Definition World.cpp:630
Joint2D * newWeldJoint(Body *bodyA, Body *bodyB, float anchorX, float anchorY, bool collideConnected=false)
Welds two bodies at a shared pixel-space anchor.
Definition WorldJoints2D.cpp:120
std::string getBeginContactFixtureATag(int index) const
Definition World.cpp:591
std::string getEndContactFixtureATag(int index) const
Definition World.cpp:603
void drawDebug(graphics::Graphics *gfx)
Optional: draw fixture AABBs via Graphics::drawSolidRect.
Definition WorldDebugDraw.cpp:117
int getEndContactBodyBId(int index) const
Definition World.cpp:600
int getBeginContactBodyBId(int index) const
Definition World.cpp:588
Joint2D * newPrismaticJoint(Body *bodyA, Body *bodyB, float anchorX, float anchorY, float axisX, float axisY, bool collideConnected=false)
Creates a prismatic slider along a pixel-space axis.
Definition WorldJoints2D.cpp:108
void setGravity(float gx, float gy)
Sets the world gravity vector in pixels/s^2.
Definition World.cpp:399
int getEndContactBodyAId(int index) const
Definition World.cpp:597
float getRayHitFraction() const
Fraction along the segment [0,1] of the closest hit.
Definition World.h:329
Joint2D * newRevoluteJoint(Body *bodyA, Body *bodyB, float anchorX, float anchorY, bool collideConnected=false)
Creates a revolute hinge at a shared pixel-space anchor.
Definition WorldJoints2D.cpp:97
float getImpactNormalX(int index) const
Definition World.cpp:627
float getImpactRelativeNormalSpeed(int index) const
Definition World.cpp:633
Body * newBody(const std::string &bodyType, float x, float y)
Creates a body in pixel-space units.
Definition World.cpp:431
Mechanism2D * newCrankSlider(Body *frame, Body *crank, Body *rod, Body *slider, float crankAnchorX, float crankAnchorY, float crankPinX, float crankPinY, float sliderPinX, float sliderPinY, float slideAxisX, float slideAxisY, bool collideConnected=false)
Builds a planar crank-slider from frame, crank, connecting rod and slider bodies.
Definition WorldJoints2D.cpp:204
int getBeginContactBodyAId(int index) const
Definition World.cpp:585
Joint2D * newGearJoint(Joint2D *joint1, Joint2D *joint2, float ratio)
Creates a gear joint that couples two revolute or prismatic joints.
Definition WorldJoints2D.cpp:151
Mechanism2D * newRatchet(Body *frame, Body *wheel, float anchorX, float anchorY, int direction, float engagementTorque, bool collideConnected=false)
Builds a one-way ratchet around a revolute hinge.
Definition WorldJoints2D.cpp:189
float getImpactNormalImpulse(int index) const
Definition World.cpp:636
std::string getEndContactFixtureBTag(int index) const
Definition World.cpp:606
int rayCast(float x1, float y1, float x2, float y2)
Closest raycast in pixel space from (x1,y1) to (x2,y2). Returns hit body id, or -1....
Definition World.cpp:650
float getImpactTangentImpulse(int index) const
Definition World.cpp:639
std::string getBeginContactFixtureBTag(int index) const
Definition World.cpp:594
void updateFull(float dt, int velocityIterations, int positionIterations)
Steps with explicit iteration counts.
Definition World.cpp:356
void clearContactEvents()
Clears collected begin/end contact and impact event buffers.
Definition World.cpp:643
std::string getImpactFixtureATag(int index) const
Definition World.cpp:615
std::string getImpactFixtureBTag(int index) const
Definition World.cpp:618
Joint2D * newMotorJoint(Body *bodyA, Body *bodyB, bool collideConnected=false)
Creates a motor joint that drives relative pose between bodies.
Definition WorldJoints2D.cpp:143
Mechanism2D * newShaft(Body *support, Body *rotor, float anchorX, float anchorY, bool collideConnected=false)
Builds a shaft (support↔rotor revolute) with optional drive motor helpers.
Definition WorldJoints2D.cpp:178
Result< void > beginTerrainLoadGravity(TerrainLoadGravityState *state, Body3D *body, bool terrainFound)
Begin monitoring a body when a containing terrain scene exists.
Definition TerrainLoadGravity.cpp:10
Result< bool > advanceTerrainLoadGravity(TerrainLoadGravityState *state, Body3D *body, bool terrainLoaded, float deltaSeconds, float activationDelay)
Advance terrain-load waiting and restore gravity after the configured delay.
Definition TerrainLoadGravity.cpp:28
void registerPhysicsCapabilities()
Registers physics capabilities.
Definition PhysicsCapabilities.cpp:158
const EditorValue * field(const EditorValue &value, const char *name)
Definition RoadNetworkEditTarget.cpp:15
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470