Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
Physics3DBindings.hpp File Reference

The Jolt module's entry points, declared once for both platforms. More...

#include <cstddef>
#include <cstdint>
Include dependency graph for Physics3DBindings.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void physics3d_init (float gx, float gy, float gz, uint32_t maxBodies)
void physics3d_shutdown ()
int physics3d_isReady ()
void physics3d_step (float dt, int collisionSteps)
 Advance the world, then refill the transform buffer with every active body.
void physics3d_optimize ()
void physics3d_setLayerMask (uint32_t layer, uint32_t mask)
 Declares which layers layer layer collides with.
int physics3d_raycastAll (float ox, float oy, float oz, float dx, float dy, float dz, uint32_t layerMask, uint32_t maxHits)
int physics3d_raycastWith (float ox, float oy, float oz, float dx, float dy, float dz, uint32_t layerMask, uint32_t flags)
 The world's nearest hit, or a character's when one is nearer and flags bit 0 asks for them.
void physics3d_setSolver (int velocityIterations, int positionIterations, int allowSleep, float bounceThreshold)
uint32_t physics3d_addCompound (uint32_t entity, uintptr_t partsPtr, uint32_t count, float px, float py, float pz, float qx, float qy, float qz, float qw, int motion, float gravityScale, float linearDamping, float angularDamping, int fixedRotation, uint32_t layer, int continuous, float friction, float restitution, int isSensor, float mass)
uint32_t physics3d_addBox (uint32_t entity, float hx, float hy, float hz, float px, float py, float pz, float qx, float qy, float qz, float qw, int motion, float gravityScale, float linearDamping, float angularDamping, int fixedRotation, uint32_t layer, int continuous, float friction, float restitution, int isSensor, float cx, float cy, float cz)
uint32_t physics3d_addSphere (uint32_t entity, float radius, float px, float py, float pz, float qx, float qy, float qz, float qw, int motion, float gravityScale, float linearDamping, float angularDamping, int fixedRotation, uint32_t layer, int continuous, float friction, float restitution, int isSensor, float cx, float cy, float cz)
uint32_t physics3d_addCapsule (uint32_t entity, float radius, float halfHeight, float px, float py, float pz, float qx, float qy, float qz, float qw, int motion, float gravityScale, float linearDamping, float angularDamping, int fixedRotation, uint32_t layer, int continuous, float friction, float restitution, int isSensor, float cx, float cy, float cz)
uint32_t physics3d_addMeshBody (uint32_t entity, uintptr_t vertexPtr, uint32_t vertexCount, uintptr_t indexPtr, uint32_t indexCount, float px, float py, float pz, float qx, float qy, float qz, float qw, uint32_t layer, float friction, float restitution)
 Registers imported geometry as a collider.
uint32_t physics3d_addConvexBody (uint32_t entity, uintptr_t vertexPtr, uint32_t vertexCount, float px, float py, float pz, float qx, float qy, float qz, float qw, int motion, float gravityScale, float linearDamping, float angularDamping, int fixedRotation, uint32_t layer, int continuous, float friction, float restitution, int isSensor)
 Registers the convex hull of imported geometry as a collider.
void physics3d_removeBody (uint32_t bodyId)
void physics3d_setTransform (uint32_t bodyId, float px, float py, float pz, float qx, float qy, float qz, float qw)
void physics3d_setLinearVelocity (uint32_t bodyId, float vx, float vy, float vz)
void physics3d_setMass (uint32_t bodyId, float mass)
void physics3d_addImpulse (uint32_t bodyId, float ix, float iy, float iz, float px, float py, float pz)
void physics3d_addAngularImpulse (uint32_t bodyId, float ix, float iy, float iz)
void physics3d_setAngularVelocity (uint32_t bodyId, float wx, float wy, float wz)
void physics3d_setGravity (float gx, float gy, float gz)
void physics3d_setAwake (uint32_t bodyId, int awake)
int physics3d_isAwake (uint32_t bodyId)
int physics3d_getBodyMassData (uint32_t bodyId)
int physics3d_getBodyState (uint32_t bodyId)
int physics3d_getBodyDynamics (uint32_t bodyId)
void physics3d_addForce (uint32_t bodyId, float fx, float fy, float fz, float px, float py, float pz)
void physics3d_addTorque (uint32_t bodyId, float tx, float ty, float tz)
 A torque of (tx, ty, tz) newton metres, over the next step.
uint32_t physics3d_addCharacter (uint32_t entity, float radius, float halfHeight, float px, float py, float pz, float maxSlope, float mass, uint32_t layer, float pushForce)
 Registers a character: an upright capsule swept against the world.
void physics3d_removeCharacter (uint32_t characterId)
void physics3d_moveCharacter (uint32_t characterId, float vx, float vy, float vz, float dt, float stepUp, float stepDown)
void physics3d_setCharacterPosition (uint32_t characterId, float px, float py, float pz)
 Puts a character somewhere, rather than moving it there.
uint32_t physics3d_addSwingTwistJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float px, float py, float pz, float ax, float ay, float az, float nx, float ny, float nz, float normalHalf, float planeHalf, float twistMin, float twistMax, int collideConnected)
 Both frames coincide at creation, so limits are relative to the authored pose.
uint32_t physics3d_addSixDOFJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float px, float py, float pz, float ax, float ay, float az, float nx, float ny, float nz, int translationMotion, int rotationMotion, float lx, float ly, float lz, float hx, float hy, float hz, float rx, float ry, float rz, float sx, float sy, float sz, int collideConnected)
 Axis motion is packed as two bits per axis: 0 locked, 1 limited, 2 free.
void physics3d_setAdvancedJointMotor (uint32_t entity, int enable, float vx, float vy, float vz, float wx, float wy, float wz, float maxForce, float maxTorque)
 Live velocity/force changes do not rebuild the joint or reset its zero pose.
uint32_t physics3d_addPointJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float px, float py, float pz, int collideConnected)
 A shared point, free to turn on all three axes — a chain link, a ragdoll limb.
uint32_t physics3d_addHingeJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float px, float py, float pz, float ax, float ay, float az, int enableLimit, float lowerAngle, float upperAngle, int enableMotor, float motorSpeed, float maxTorque, int collideConnected)
uint32_t physics3d_addSliderJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float px, float py, float pz, float ax, float ay, float az, int enableLimit, float lower, float upper, int enableMotor, float motorSpeed, float maxForce, int collideConnected)
 One axis of travel — a lift, a piston, a sliding door.
uint32_t physics3d_addDistanceJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, float ax, float ay, float az, float bx, float by, float bz, float minLength, float maxLength, float frequency, float damping, int collideConnected)
uint32_t physics3d_addFixedJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB, int collideConnected)
 No freedom at all: the two move as one, until something breaks them apart.
void physics3d_removeJoint (uint32_t entity, uint32_t bodyA, uint32_t bodyB)
void physics3d_setJointMotor (uint32_t entity, int enable, float speed)
 Drive an existing hinge or slider from gameplay, without rebuilding the joint.
int physics3d_jointForce (uint32_t entity)
void physics3d_setJointLimits (uint32_t entity, int enable, float lower, float upper)
void physics3d_setJointMotorLimit (uint32_t entity, float limit)
void physics3d_setDistanceJoint (uint32_t entity, float minLength, float maxLength, float frequency, float damping)
float physics3d_jointValue (uint32_t entity)
int physics3d_raycast (float ox, float oy, float oz, float dx, float dy, float dz, uint32_t layerMask)
int physics3d_boxCast (float px, float py, float pz, float hx, float hy, float hz, float qx, float qy, float qz, float qw, float dx, float dy, float dz, uint32_t layerMask)
int physics3d_capsuleCast (float px, float py, float pz, float radius, float halfHeight, float qx, float qy, float qz, float qw, float dx, float dy, float dz, uint32_t layerMask)
int physics3d_sphereCast (float px, float py, float pz, float radius, float dx, float dy, float dz, uint32_t layerMask)
int physics3d_overlapSphere (float px, float py, float pz, float radius, uint32_t layerMask)
 Everything a sphere at this position overlaps.
int physics3d_overlapBox (float px, float py, float pz, float hx, float hy, float hz, uint32_t layerMask)
 The same for a box, given its half-extents.
uintptr_t physics3d_transforms ()
size_t physics3d_transformsBytes ()
uintptr_t physics3d_contactEnters ()
size_t physics3d_contactEntersBytes ()
uintptr_t physics3d_contactEnterSpeeds ()
size_t physics3d_contactEnterSpeedsBytes ()
uintptr_t physics3d_contactEnterMasses ()
size_t physics3d_contactEnterMassesBytes ()
uintptr_t physics3d_characterHits ()
size_t physics3d_characterHitsBytes ()
uintptr_t physics3d_contactExits ()
size_t physics3d_contactExitsBytes ()
uintptr_t physics3d_sensorEnters ()
size_t physics3d_sensorEntersBytes ()
uintptr_t physics3d_sensorExits ()
size_t physics3d_sensorExitsBytes ()
uintptr_t physics3d_queryResult ()
size_t physics3d_queryResultBytes ()

Detailed Description

The Jolt module's entry points, declared once for both platforms.

The same arrangement the 2D module has: plain extern "C" over one world, linked into a wasm side module on the web and compiled into the host binary on a device, where there is no dynamic-linking story to have. Until this file existed the SDK's Physics3DWasmModule interface was the only statement of the surface and could drift from the C++ silently — and a native host had no way to bind it at all.

Bulk data crosses as an offset into the caller's heap, so the readback getters carry @heapreturn: they hand back memory the MODULE owns, and a native wrapper copies exactly that many bytes into the heap the SDK reads. The byte counts come from the module, never from a stride guessed on the far side.

Author
ESEngine Team
Date
2026

Definition in file Physics3DBindings.hpp.

Function Documentation

◆ physics3d_addAngularImpulse()

void physics3d_addAngularImpulse ( uint32_t bodyId,
float ix,
float iy,
float iz )

Definition at line 601 of file Physics3DModuleEntry.cpp.

◆ physics3d_addBox()

uint32_t physics3d_addBox ( uint32_t entity,
float hx,
float hy,
float hz,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
int motion,
float gravityScale,
float linearDamping,
float angularDamping,
int fixedRotation,
uint32_t layer,
int continuous,
float friction,
float restitution,
int isSensor,
float cx,
float cy,
float cz )

Definition at line 384 of file Physics3DModuleEntry.cpp.

◆ physics3d_addCapsule()

uint32_t physics3d_addCapsule ( uint32_t entity,
float radius,
float halfHeight,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
int motion,
float gravityScale,
float linearDamping,
float angularDamping,
int fixedRotation,
uint32_t layer,
int continuous,
float friction,
float restitution,
int isSensor,
float cx,
float cy,
float cz )

halfHeight is the cylinder half-height, so the capsule is 2*halfHeight + 2*radius tall — the same convention CapsuleCollider2D uses in 2D.

Definition at line 414 of file Physics3DModuleEntry.cpp.

◆ physics3d_addCharacter()

uint32_t physics3d_addCharacter ( uint32_t entity,
float radius,
float halfHeight,
float px,
float py,
float pz,
float maxSlope,
float mass,
uint32_t layer,
float pushForce )

Registers a character: an upright capsule swept against the world.

Parameters
maxSlopeSteepest ground the character can stand on, in radians.
Returns
the character id, or 0 when there is no world.

Definition at line 672 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::defaultMaterial(), and esengine::physics3d_physx::KIND_CHARACTER.

◆ physics3d_addCompound()

uint32_t physics3d_addCompound ( uint32_t entity,
uintptr_t partsPtr,
uint32_t count,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
int motion,
float gravityScale,
float linearDamping,
float angularDamping,
int fixedRotation,
uint32_t layer,
int continuous,
float friction,
float restitution,
int isSensor,
float mass )

Each primitive is 11 floats: kind, dimensions.xyz, offset.xyz, rotation.xyzw. The compound remains ONE body, so children cannot separate under gravity.

Definition at line 352 of file Physics3DModuleEntry.cpp.

References physics3d_removeBody().

◆ physics3d_addConvexBody()

uint32_t physics3d_addConvexBody ( uint32_t entity,
uintptr_t vertexPtr,
uint32_t vertexCount,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
int motion,
float gravityScale,
float linearDamping,
float angularDamping,
int fixedRotation,
uint32_t layer,
int continuous,
float friction,
float restitution,
int isSensor )

Registers the convex hull of imported geometry as a collider.

The hull is what makes imported geometry usable as a DYNAMIC body: Jolt cannot give a triangle soup an inertia tensor, so a mesh collider is scenery whatever its RigidBody3D says.

Parameters
vertexPtrvertexCount * 3 floats, in metres, in the body's own space.

Definition at line 478 of file Physics3DModuleEntry.cpp.

◆ physics3d_addDistanceJoint()

uint32_t physics3d_addDistanceJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float ax,
float ay,
float az,
float bx,
float by,
float bz,
float minLength,
float maxLength,
float frequency,
float damping,
int collideConnected )

A distance kept between two points — a rope (max only), a rod (min = max), or a spring when a frequency is given.

Definition at line 359 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Distance, and esengine::physics3d_physx::physics().

◆ physics3d_addFixedJoint()

uint32_t physics3d_addFixedJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
int collideConnected )

No freedom at all: the two move as one, until something breaks them apart.

Definition at line 383 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Fixed, and esengine::physics3d_physx::physics().

◆ physics3d_addForce()

void physics3d_addForce ( uint32_t bodyId,
float fx,
float fy,
float fz,
float px,
float py,
float pz )

A force of (fx, fy, fz) newtons at the world point (px, py, pz), over the next step. It turns the body as well as pushing it, by as much as the point is off the centre of mass; and it wakes a body that has gone to sleep.

Definition at line 584 of file Physics3DModuleEntry.cpp.

◆ physics3d_addHingeJoint()

uint32_t physics3d_addHingeJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float px,
float py,
float pz,
float ax,
float ay,
float az,
int enableLimit,
float lowerAngle,
float upperAngle,
int enableMotor,
float motorSpeed,
float maxTorque,
int collideConnected )

One axis of rotation, optionally limited and optionally driven — a door, a lever, a wheel with a motor.

Definition at line 298 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Hinge, and esengine::physics3d_physx::physics().

◆ physics3d_addImpulse()

void physics3d_addImpulse ( uint32_t bodyId,
float ix,
float iy,
float iz,
float px,
float py,
float pz )

Definition at line 592 of file Physics3DModuleEntry.cpp.

◆ physics3d_addMeshBody()

uint32_t physics3d_addMeshBody ( uint32_t entity,
uintptr_t vertexPtr,
uint32_t vertexCount,
uintptr_t indexPtr,
uint32_t indexCount,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
uint32_t layer,
float friction,
float restitution )

Registers imported geometry as a collider.

Triangles rather than a shape: the .esmesh format belongs to the asset layer, which hands over positions it has already extracted and scaled. A mesh collider is always STATIC — Jolt cannot give a triangle soup an inertia tensor, so there is nothing for a solver to push.

Parameters
vertexPtrvertexCount * 3 floats, in metres, in the body's own space.
indexPtrindexCount uint32 indices; must be a triangle list.

Definition at line 437 of file Physics3DModuleEntry.cpp.

◆ physics3d_addPointJoint()

uint32_t physics3d_addPointJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float px,
float py,
float pz,
int collideConnected )

A shared point, free to turn on all three axes — a chain link, a ragdoll limb.

Definition at line 284 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::physics(), and esengine::physics3d_physx::Point.

◆ physics3d_addSixDOFJoint()

uint32_t physics3d_addSixDOFJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float px,
float py,
float pz,
float ax,
float ay,
float az,
float nx,
float ny,
float nz,
int translationMotion,
int rotationMotion,
float lx,
float ly,
float lz,
float hx,
float hy,
float hz,
float rx,
float ry,
float rz,
float sx,
float sy,
float sz,
int collideConnected )

Axis motion is packed as two bits per axis: 0 locked, 1 limited, 2 free.

Definition at line 218 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::SixDOF.

◆ physics3d_addSliderJoint()

uint32_t physics3d_addSliderJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float px,
float py,
float pz,
float ax,
float ay,
float az,
int enableLimit,
float lower,
float upper,
int enableMotor,
float motorSpeed,
float maxForce,
int collideConnected )

One axis of travel — a lift, a piston, a sliding door.

Definition at line 327 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Slider.

◆ physics3d_addSphere()

uint32_t physics3d_addSphere ( uint32_t entity,
float radius,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw,
int motion,
float gravityScale,
float linearDamping,
float angularDamping,
int fixedRotation,
uint32_t layer,
int continuous,
float friction,
float restitution,
int isSensor,
float cx,
float cy,
float cz )

Definition at line 398 of file Physics3DModuleEntry.cpp.

◆ physics3d_addSwingTwistJoint()

uint32_t physics3d_addSwingTwistJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB,
float px,
float py,
float pz,
float ax,
float ay,
float az,
float nx,
float ny,
float nz,
float normalHalf,
float planeHalf,
float twistMin,
float twistMax,
int collideConnected )

Both frames coincide at creation, so limits are relative to the authored pose.

Definition at line 190 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::SwingTwist.

◆ physics3d_addTorque()

void physics3d_addTorque ( uint32_t bodyId,
float tx,
float ty,
float tz )

A torque of (tx, ty, tz) newton metres, over the next step.

Definition at line 659 of file Physics3DModuleEntry.cpp.

◆ physics3d_boxCast()

int physics3d_boxCast ( float px,
float py,
float pz,
float hx,
float hy,
float hz,
float qx,
float qy,
float qz,
float qw,
float dx,
float dy,
float dz,
uint32_t layerMask )

Definition at line 950 of file Physics3DModuleEntry.cpp.

References castShapeQuery(), and turnOf().

◆ physics3d_capsuleCast()

int physics3d_capsuleCast ( float px,
float py,
float pz,
float radius,
float halfHeight,
float qx,
float qy,
float qz,
float qw,
float dx,
float dy,
float dz,
uint32_t layerMask )

Definition at line 960 of file Physics3DModuleEntry.cpp.

References castShapeQuery(), physics3d_sphereCast(), and turnOf().

◆ physics3d_characterHits()

uintptr_t physics3d_characterHits ( )

Definition at line 1120 of file Physics3DModuleEntry.cpp.

◆ physics3d_characterHitsBytes()

size_t physics3d_characterHitsBytes ( )

Definition at line 1125 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEnterMasses()

uintptr_t physics3d_contactEnterMasses ( )

Definition at line 1130 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEnterMassesBytes()

size_t physics3d_contactEnterMassesBytes ( )

Definition at line 1135 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEnters()

uintptr_t physics3d_contactEnters ( )

Definition at line 1150 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEntersBytes()

size_t physics3d_contactEntersBytes ( )

Definition at line 1155 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEnterSpeeds()

uintptr_t physics3d_contactEnterSpeeds ( )

Definition at line 1140 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactEnterSpeedsBytes()

size_t physics3d_contactEnterSpeedsBytes ( )

Definition at line 1145 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactExits()

uintptr_t physics3d_contactExits ( )

Definition at line 1160 of file Physics3DModuleEntry.cpp.

◆ physics3d_contactExitsBytes()

size_t physics3d_contactExitsBytes ( )

Definition at line 1165 of file Physics3DModuleEntry.cpp.

◆ physics3d_getBodyDynamics()

int physics3d_getBodyDynamics ( uint32_t bodyId)

Writes (mass, wx,wy,wz) into the query buffer: the body's mass in kilograms and its angular velocity in radians a second, world space. 0 when the body is gone or does not move (a static or kinematic body has no mass to push).

Definition at line 569 of file Physics3DModuleEntry.cpp.

◆ physics3d_getBodyMassData()

int physics3d_getBodyMassData ( uint32_t bodyId)

Definition at line 638 of file Physics3DModuleEntry.cpp.

◆ physics3d_getBodyState()

int physics3d_getBodyState ( uint32_t bodyId)

Writes (px,py,pz, qx,qy,qz,qw, vx,vy,vz) into the query buffer; 0 when the body is gone. One body's state, for a caller that wants it outside the step readback.

Definition at line 549 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::Body::actor, and esengine::physics3d_physx::Body::kinematicVelocity.

◆ physics3d_init()

void physics3d_init ( float gx,
float gy,
float gz,
uint32_t maxBodies )

Definition at line 223 of file Physics3DModuleEntry.cpp.

◆ physics3d_isAwake()

int physics3d_isAwake ( uint32_t bodyId)

Definition at line 632 of file Physics3DModuleEntry.cpp.

◆ physics3d_isReady()

int physics3d_isReady ( )

Definition at line 269 of file Physics3DModuleEntry.cpp.

◆ physics3d_jointForce()

int physics3d_jointForce ( uint32_t entity)

Definition at line 493 of file Physics3DConstraints.cpp.

◆ physics3d_jointValue()

float physics3d_jointValue ( uint32_t entity)

What the joint is at right now — a hinge's angle, a slider's travel — so a game can watch a door swing without integrating it a second time.

Definition at line 550 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Hinge, and esengine::physics3d_physx::Slider.

◆ physics3d_moveCharacter()

void physics3d_moveCharacter ( uint32_t characterId,
float vx,
float vy,
float vz,
float dt,
float stepUp,
float stepDown )

◆ physics3d_optimize()

void physics3d_optimize ( )

Rebuild the broad-phase tree. Worth calling once after the static geometry of a level is in, and never per frame.

Definition at line 343 of file Physics3DModuleEntry.cpp.

◆ physics3d_overlapBox()

int physics3d_overlapBox ( float px,
float py,
float pz,
float hx,
float hy,
float hz,
uint32_t layerMask )

The same for a box, given its half-extents.

Definition at line 918 of file Physics3DModuleEntry.cpp.

◆ physics3d_overlapSphere()

int physics3d_overlapSphere ( float px,
float py,
float pz,
float radius,
uint32_t layerMask )

Everything a sphere at this position overlaps.

Writes (entity, px,py,pz) per hit into the query buffer and returns how many — the question a spawn point asks before it spawns.

Definition at line 910 of file Physics3DModuleEntry.cpp.

◆ physics3d_queryResult()

uintptr_t physics3d_queryResult ( )

Definition at line 1190 of file Physics3DModuleEntry.cpp.

◆ physics3d_queryResultBytes()

size_t physics3d_queryResultBytes ( )

Definition at line 1195 of file Physics3DModuleEntry.cpp.

◆ physics3d_raycast()

int physics3d_raycast ( float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
uint32_t layerMask )

Nearest hit along the ray. Writes (entity, fraction, px,py,pz, nx,ny,nz) into the query buffer and returns 1; returns 0 and leaves it empty when nothing is hit.

Definition at line 997 of file Physics3DModuleEntry.cpp.

References physics3d_raycastWith().

Referenced by physics3d_raycastWith().

◆ physics3d_raycastAll()

int physics3d_raycastAll ( float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
uint32_t layerMask,
uint32_t maxHits )

Every body on a line, nearest first, at most maxHits of them: writes (entity, entry, exit, px,py,pz, nx,ny,nz) for each into the query buffer, where entry and exit are fractions of the line at which it goes into the body and out of it (1 where the line ends inside it), the point and normal where it goes in. Returns how many. What a shot that passes through thin cover needs: the second body, and how much of the first it crossed to get there.

Definition at line 1024 of file Physics3DModuleEntry.cpp.

◆ physics3d_raycastWith()

int physics3d_raycastWith ( float ox,
float oy,
float oz,
float dx,
float dy,
float dz,
uint32_t layerMask,
uint32_t flags )

The world's nearest hit, or a character's when one is nearer and flags bit 0 asks for them.

physics3d_raycast with flags: bit 0 also meets characters (a shot, which must hit an enemy that walks). Plain physics3d_raycast stays blind to them: line of sight and a camera's boom ask about the world.

A CharacterVirtual is not a body, so the narrow phase cannot meet it; each capsule is cast against in its own space instead, which is what Jolt's own CharacterVirtual queries do. A ray that starts inside a capsule meets it at 0 — a shooter's own character is left out by its layer.

Definition at line 1072 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::Character::controller, esengine::physics3d_physx::Character::entity, esengine::physics3d_physx::entityOf(), esengine::physics3d_physx::Character::layer, and physics3d_raycast().

Referenced by physics3d_raycast().

◆ physics3d_removeBody()

void physics3d_removeBody ( uint32_t bodyId)

Definition at line 508 of file Physics3DModuleEntry.cpp.

Referenced by physics3d_addCompound().

◆ physics3d_removeCharacter()

void physics3d_removeCharacter ( uint32_t characterId)

Definition at line 700 of file Physics3DModuleEntry.cpp.

◆ physics3d_removeJoint()

void physics3d_removeJoint ( uint32_t entity,
uint32_t bodyA,
uint32_t bodyB )

Definition at line 396 of file Physics3DConstraints.cpp.

◆ physics3d_sensorEnters()

uintptr_t physics3d_sensorEnters ( )

Definition at line 1170 of file Physics3DModuleEntry.cpp.

◆ physics3d_sensorEntersBytes()

size_t physics3d_sensorEntersBytes ( )

Definition at line 1175 of file Physics3DModuleEntry.cpp.

◆ physics3d_sensorExits()

uintptr_t physics3d_sensorExits ( )

Definition at line 1180 of file Physics3DModuleEntry.cpp.

◆ physics3d_sensorExitsBytes()

size_t physics3d_sensorExitsBytes ( )

Definition at line 1185 of file Physics3DModuleEntry.cpp.

◆ physics3d_setAdvancedJointMotor()

void physics3d_setAdvancedJointMotor ( uint32_t entity,
int enable,
float vx,
float vy,
float vz,
float wx,
float wy,
float wz,
float maxForce,
float maxTorque )

Live velocity/force changes do not rebuild the joint or reset its zero pose.

Definition at line 254 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::SixDOF, and esengine::physics3d_physx::SwingTwist.

◆ physics3d_setAngularVelocity()

void physics3d_setAngularVelocity ( uint32_t bodyId,
float wx,
float wy,
float wz )

Definition at line 609 of file Physics3DModuleEntry.cpp.

◆ physics3d_setAwake()

void physics3d_setAwake ( uint32_t bodyId,
int awake )

Definition at line 624 of file Physics3DModuleEntry.cpp.

◆ physics3d_setCharacterPosition()

void physics3d_setCharacterPosition ( uint32_t characterId,
float px,
float py,
float pz )

Puts a character somewhere, rather than moving it there.

The velocity goes with it. A CharacterVirtual carries its own vertical speed between steps, so a character teleported mid-fall would arrive still falling and drive itself through the floor it was placed on.

Definition at line 811 of file Physics3DModuleEntry.cpp.

◆ physics3d_setDistanceJoint()

void physics3d_setDistanceJoint ( uint32_t entity,
float minLength,
float maxLength,
float frequency,
float damping )

Definition at line 479 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Distance, and wakeEnds().

◆ physics3d_setGravity()

void physics3d_setGravity ( float gx,
float gy,
float gz )

Definition at line 618 of file Physics3DModuleEntry.cpp.

◆ physics3d_setJointLimits()

void physics3d_setJointLimits ( uint32_t entity,
int enable,
float lower,
float upper )

◆ physics3d_setJointMotor()

void physics3d_setJointMotor ( uint32_t entity,
int enable,
float speed )

Drive an existing hinge or slider from gameplay, without rebuilding the joint.

Definition at line 421 of file Physics3DConstraints.cpp.

References esengine::physics3d_physx::Hinge, and esengine::physics3d_physx::Slider.

◆ physics3d_setJointMotorLimit()

void physics3d_setJointMotorLimit ( uint32_t entity,
float limit )

◆ physics3d_setLayerMask()

void physics3d_setLayerMask ( uint32_t layer,
uint32_t mask )

Declares which layers layer layer collides with.

Both sides must agree, so a body only meets another when each names the other — one of them saying no is enough to keep them apart. Set before bodies are registered: an ObjectLayer is fixed at creation.

Definition at line 278 of file Physics3DModuleEntry.cpp.

References esengine::physics3d::Layers::COUNT, esengine::physics3d_physx::LAYER_COUNT, esengine::physics3d::layerMatrix(), and esengine::physics3d::LayerMatrix::masks.

◆ physics3d_setLinearVelocity()

void physics3d_setLinearVelocity ( uint32_t bodyId,
float vx,
float vy,
float vz )

◆ physics3d_setMass()

void physics3d_setMass ( uint32_t bodyId,
float mass )

Definition at line 534 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::Body::actor.

◆ physics3d_setSolver()

void physics3d_setSolver ( int velocityIterations,
int positionIterations,
int allowSleep,
float bounceThreshold )

The project's solver settings. Each value <= 0 keeps the backend's own default (Jolt's for Jolt, the usual ones for PhysX); allowSleep is 0 or 1. After init, before bodies.

Definition at line 285 of file Physics3DModuleEntry.cpp.

◆ physics3d_setTransform()

void physics3d_setTransform ( uint32_t bodyId,
float px,
float py,
float pz,
float qx,
float qy,
float qz,
float qw )

Definition at line 519 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::Body::actor.

◆ physics3d_shutdown()

void physics3d_shutdown ( )

Definition at line 244 of file Physics3DModuleEntry.cpp.

◆ physics3d_sphereCast()

int physics3d_sphereCast ( float px,
float py,
float pz,
float radius,
float dx,
float dy,
float dz,
uint32_t layerMask )

◆ physics3d_step()

void physics3d_step ( float dt,
int collisionSteps )

Advance the world, then refill the transform buffer with every active body.

Definition at line 301 of file Physics3DModuleEntry.cpp.

References esengine::physics3d_physx::Body::character.

◆ physics3d_transforms()

uintptr_t physics3d_transforms ( )

Definition at line 1110 of file Physics3DModuleEntry.cpp.

◆ physics3d_transformsBytes()

size_t physics3d_transformsBytes ( )

Definition at line 1115 of file Physics3DModuleEntry.cpp.