|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
The 3D physics side module's entry points. More...
#include "./Physics3DBindings.hpp"#include "./Physics3DContext.hpp"#include <Jolt/Physics/Body/BodyCreationSettings.h>#include <Jolt/Physics/Collision/CastResult.h>#include <Jolt/Physics/Collision/RayCast.h>#include <Jolt/Physics/Collision/Shape/BoxShape.h>#include <Jolt/Physics/Collision/Shape/CapsuleShape.h>#include <Jolt/Physics/Collision/Shape/ConvexHullShape.h>#include <Jolt/Physics/Collision/Shape/MeshShape.h>#include <Jolt/Physics/Collision/Shape/RotatedTranslatedShape.h>#include <Jolt/Physics/Collision/Shape/SphereShape.h>#include <Jolt/Physics/Collision/Shape/StaticCompoundShape.h>#include <Jolt/Physics/Character/CharacterVirtual.h>#include <Jolt/Physics/Collision/CollideShape.h>#include <Jolt/Physics/Collision/CollisionCollectorImpl.h>#include <Jolt/Physics/Collision/CollisionDispatch.h>#include <Jolt/Physics/Collision/ContactListener.h>#include <limits>#include <Jolt/Physics/Collision/ShapeCast.h>#include <Jolt/RegisterTypes.h>#include <cstddef>#include <algorithm>#include <cmath>#include <vector>
Go to the source code of this file.
Namespaces | |
| namespace | esengine |
| namespace | esengine::physics3d |
Functions | |
| Context & | esengine::physics3d::ctx () |
| LayerMatrix & | esengine::physics3d::layerMatrix () |
| void | physics3d_init (float gx, float gy, float gz, uint32_t maxBodies) |
| void | physics3d_shutdown () |
| int | physics3d_isReady () |
| void | physics3d_setLayerMask (uint32_t layer, uint32_t mask) |
| Declares which layers layer layer collides with. | |
| void | physics3d_setSolver (int velocityIterations, int positionIterations, int allowSleep, float bounceThreshold) |
| void | physics3d_step (float dt, int collisionSteps) |
| Advance the world, then refill the transform buffer with every active body. | |
| void | physics3d_optimize () |
| 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) |
| 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_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) |
| 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) |
| static void | noteCharacterMeetings (uint32_t characterId, const CharacterVirtual &character, Vec3Arg velocity) |
| Moves a character by its velocity for one step. | |
| 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. | |
| 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. | |
| static int | castShapeQuery (const Shape &shape, RMat44Arg start, Vec3Arg direction, uint32_t layerMask) |
| Sweeps a sphere along a path and reports the first thing it meets. | |
| int | physics3d_sphereCast (float px, float py, float pz, float radius, float dx, float dy, float dz, uint32_t layerMask) |
| static Quat | turnOf (float qx, float qy, float qz, float qw) |
| A turn that is not one - zero, or not a number - is no turn. | |
| 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_raycast (float ox, float oy, float oz, float dx, float dy, float dz, uint32_t layerMask) |
| 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. | |
| uintptr_t | physics3d_transforms () |
| size_t | physics3d_transformsBytes () |
| uintptr_t | physics3d_characterHits () |
| size_t | physics3d_characterHitsBytes () |
| uintptr_t | physics3d_contactEnterMasses () |
| size_t | physics3d_contactEnterMassesBytes () |
| uintptr_t | physics3d_contactEnterSpeeds () |
| size_t | physics3d_contactEnterSpeedsBytes () |
| uintptr_t | physics3d_contactEnters () |
| size_t | physics3d_contactEntersBytes () |
| 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 () |
The 3D physics side module's entry points.
One world, built on demand and stepped by the SDK — the same shape as the 2D module beside it, because the SDK drives both the same way. What differs is only what a body is: a shape in space with an orientation, rather than a shape in a plane with an angle.
Definition in file Physics3DModuleEntry.cpp.
|
static |
Sweeps a sphere along a path and reports the first thing it meets.
What a ray cannot answer: a ray is infinitely thin, so it slips through the very gaps a moving body would not fit. Writes (entity, fraction, px,py,pz, nx,ny,nz); returns 0 for a clear path.
The first body a shape swept from start along direction meets, written to the query buffer as (entity, fraction, px,py,pz, nx,ny,nz); 1 for a hit.
Definition at line 971 of file Physics3DModuleEntry.cpp.
Referenced by physics3d_boxCast(), physics3d_capsuleCast(), and physics3d_sphereCast().
|
static |
Moves a character by its velocity for one step.
ExtendedUpdate is Jolt's own combination of move, stick-to-floor and walk-stairs: without it a character stops dead at a 10cm step and launches off the top of every slope it walks down. Writes (px,py,pz, groundState, nx,ny,nz, vx,vy,vz) to the query buffer. What a character ran into on this move that it was not already touching: told once, with how fast it closed and the mass it met with, as a contact between bodies is.
Definition at line 718 of file Physics3DModuleEntry.cpp.
Referenced by physics3d_moveCharacter().
| void physics3d_addAngularImpulse | ( | uint32_t | bodyId, |
| float | ix, | ||
| float | iy, | ||
| float | iz ) |
Definition at line 601 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| 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.
| maxSlope | Steepest ground the character can stand on, in radians. |
Definition at line 672 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| vertexPtr | vertexCount * 3 floats, in metres, in the body's own space. |
Definition at line 478 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| 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.
| vertexPtr | vertexCount * 3 floats, in metres, in the body's own space. |
| indexPtr | indexCount uint32 indices; must be a triangle list. |
Definition at line 437 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| 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.
| 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.
| uintptr_t physics3d_characterHits | ( | ) |
Definition at line 1120 of file Physics3DModuleEntry.cpp.
| size_t physics3d_characterHitsBytes | ( | ) |
Definition at line 1125 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_contactEnterMasses | ( | ) |
Definition at line 1130 of file Physics3DModuleEntry.cpp.
| size_t physics3d_contactEnterMassesBytes | ( | ) |
Definition at line 1135 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_contactEnters | ( | ) |
Definition at line 1150 of file Physics3DModuleEntry.cpp.
| size_t physics3d_contactEntersBytes | ( | ) |
Definition at line 1155 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_contactEnterSpeeds | ( | ) |
Definition at line 1140 of file Physics3DModuleEntry.cpp.
| size_t physics3d_contactEnterSpeedsBytes | ( | ) |
Definition at line 1145 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_contactExits | ( | ) |
Definition at line 1160 of file Physics3DModuleEntry.cpp.
| size_t physics3d_contactExitsBytes | ( | ) |
Definition at line 1165 of file Physics3DModuleEntry.cpp.
| 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.
| int physics3d_getBodyMassData | ( | uint32_t | bodyId | ) |
Definition at line 638 of file Physics3DModuleEntry.cpp.
| 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.
| void physics3d_init | ( | float | gx, |
| float | gy, | ||
| float | gz, | ||
| uint32_t | maxBodies ) |
Definition at line 223 of file Physics3DModuleEntry.cpp.
| int physics3d_isAwake | ( | uint32_t | bodyId | ) |
Definition at line 632 of file Physics3DModuleEntry.cpp.
| int physics3d_isReady | ( | ) |
Definition at line 269 of file Physics3DModuleEntry.cpp.
| void physics3d_moveCharacter | ( | uint32_t | characterId, |
| float | vx, | ||
| float | vy, | ||
| float | vz, | ||
| float | dt, | ||
| float | stepUp, | ||
| float | stepDown ) |
Definition at line 751 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| 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.
| uintptr_t physics3d_queryResult | ( | ) |
Definition at line 1190 of file Physics3DModuleEntry.cpp.
| size_t physics3d_queryResultBytes | ( | ) |
Definition at line 1195 of file Physics3DModuleEntry.cpp.
| 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.
Referenced by physics3d_raycastWith().
| 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.
| 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.
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.
| void physics3d_removeBody | ( | uint32_t | bodyId | ) |
Definition at line 508 of file Physics3DModuleEntry.cpp.
| void physics3d_removeCharacter | ( | uint32_t | characterId | ) |
Definition at line 700 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_sensorEnters | ( | ) |
Definition at line 1170 of file Physics3DModuleEntry.cpp.
| size_t physics3d_sensorEntersBytes | ( | ) |
Definition at line 1175 of file Physics3DModuleEntry.cpp.
| uintptr_t physics3d_sensorExits | ( | ) |
Definition at line 1180 of file Physics3DModuleEntry.cpp.
| size_t physics3d_sensorExitsBytes | ( | ) |
Definition at line 1185 of file Physics3DModuleEntry.cpp.
| void physics3d_setAngularVelocity | ( | uint32_t | bodyId, |
| float | wx, | ||
| float | wy, | ||
| float | wz ) |
Definition at line 609 of file Physics3DModuleEntry.cpp.
| void physics3d_setAwake | ( | uint32_t | bodyId, |
| int | awake ) |
Definition at line 624 of file Physics3DModuleEntry.cpp.
| 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.
| void physics3d_setGravity | ( | float | gx, |
| float | gy, | ||
| float | gz ) |
Definition at line 618 of file Physics3DModuleEntry.cpp.
| 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.
| void physics3d_setLinearVelocity | ( | uint32_t | bodyId, |
| float | vx, | ||
| float | vy, | ||
| float | vz ) |
Definition at line 528 of file Physics3DModuleEntry.cpp.
| void physics3d_setMass | ( | uint32_t | bodyId, |
| float | mass ) |
Definition at line 534 of file Physics3DModuleEntry.cpp.
| 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.
| 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.
| void physics3d_shutdown | ( | ) |
Definition at line 244 of file Physics3DModuleEntry.cpp.
| int physics3d_sphereCast | ( | float | px, |
| float | py, | ||
| float | pz, | ||
| float | radius, | ||
| float | dx, | ||
| float | dy, | ||
| float | dz, | ||
| uint32_t | layerMask ) |
Definition at line 934 of file Physics3DModuleEntry.cpp.
Referenced by physics3d_capsuleCast().
| 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.
| uintptr_t physics3d_transforms | ( | ) |
Definition at line 1110 of file Physics3DModuleEntry.cpp.
| size_t physics3d_transformsBytes | ( | ) |
Definition at line 1115 of file Physics3DModuleEntry.cpp.
|
static |
A turn that is not one - zero, or not a number - is no turn.
Definition at line 943 of file Physics3DModuleEntry.cpp.
Referenced by physics3d_boxCast(), and physics3d_capsuleCast().