@series-inc/rundot-syncplay 6.0.0-rc.2 → 6.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -0
- package/core/deterministic-math.d.ts +75 -1
- package/core/native/instance_ledger.hpp +1095 -0
- package/core/native/legacy_checkpoint_ids.hpp +107 -0
- package/core/native/physics/abi.cpp +39 -211
- package/core/native/physics/abi.hpp +2 -6
- package/core/native/physics/articulation.cpp +1434 -0
- package/core/native/physics/articulation.hpp +279 -0
- package/core/native/physics/buoyancy.cpp +1588 -0
- package/core/native/physics/buoyancy.hpp +254 -0
- package/core/native/physics/capsule_triangle.cpp +168 -0
- package/core/native/physics/capsule_triangle.hpp +40 -0
- package/core/native/physics/capsule_triangle_native.inc +291 -0
- package/core/native/physics/certified_sum.hpp +218 -0
- package/core/native/physics/character.cpp +638 -0
- package/core/native/physics/character.hpp +169 -0
- package/core/native/physics/checkpoint_schema.hpp +379 -0
- package/core/native/physics/cloth.cpp +1401 -0
- package/core/native/physics/cloth.hpp +357 -0
- package/core/native/physics/constraint_rows.cpp +363 -2
- package/core/native/physics/constraint_rows.hpp +72 -1
- package/core/native/physics/deformable_query.cpp +1630 -0
- package/core/native/physics/deformable_query.hpp +578 -0
- package/core/native/physics/distance.cpp +1166 -0
- package/core/native/physics/distance.hpp +151 -0
- package/core/native/physics/exact/exact-applied.cpp +101 -0
- package/core/native/physics/exact/exact-applied.hpp +112 -0
- package/core/native/physics/exact/exact-dyadic.cpp +691 -0
- package/core/native/physics/exact/exact-dyadic.hpp +58 -0
- package/core/native/physics/exact/exact-operation.hpp +51 -0
- package/core/native/physics/exact/word-core.hpp +262 -0
- package/core/native/physics/extended_abi.cpp +1242 -0
- package/core/native/physics/extended_abi.hpp +355 -0
- package/core/native/physics/extended_abi_characters.cpp +261 -0
- package/core/native/physics/extended_abi_characters.hpp +434 -0
- package/core/native/physics/extended_abi_core_features.cpp +713 -0
- package/core/native/physics/extended_abi_core_features.hpp +226 -0
- package/core/native/physics/extended_abi_deformables.cpp +448 -0
- package/core/native/physics/extended_abi_deformables.hpp +867 -0
- package/core/native/physics/extended_abi_vehicles.cpp +411 -0
- package/core/native/physics/extended_abi_vehicles.hpp +222 -0
- package/core/native/physics/fracture.cpp +1981 -0
- package/core/native/physics/fracture.hpp +460 -0
- package/core/native/physics/gear.cpp +563 -0
- package/core/native/physics/gear.hpp +158 -0
- package/core/native/physics/geometry_memory.hpp +476 -0
- package/core/native/physics/geometry_store.cpp +547 -0
- package/core/native/physics/geometry_store.hpp +134 -0
- package/core/native/physics/lag_compensation.cpp +1626 -0
- package/core/native/physics/lag_compensation.hpp +405 -0
- package/core/native/physics/mass_properties.cpp +449 -0
- package/core/native/physics/mass_properties.hpp +23 -0
- package/core/native/physics/material_pose.hpp +988 -0
- package/core/native/physics/particles.cpp +1065 -0
- package/core/native/physics/particles.hpp +261 -0
- package/core/native/physics/path_joint.cpp +781 -0
- package/core/native/physics/path_joint.hpp +154 -0
- package/core/native/physics/physics.cpp +13043 -1065
- package/core/native/physics/physics.hpp +184 -8
- package/core/native/physics/planar_deformable.cpp +2433 -0
- package/core/native/physics/planar_deformable.hpp +889 -0
- package/core/native/physics/platformer_2d.cpp +1353 -0
- package/core/native/physics/platformer_2d.hpp +340 -0
- package/core/native/physics/powered_ragdoll.cpp +1100 -0
- package/core/native/physics/powered_ragdoll.hpp +279 -0
- package/core/native/physics/powertrain.cpp +586 -0
- package/core/native/physics/powertrain.hpp +180 -0
- package/core/native/physics/pulley.cpp +311 -0
- package/core/native/physics/pulley.hpp +121 -0
- package/core/native/physics/ragdoll.cpp +586 -0
- package/core/native/physics/ragdoll.hpp +221 -0
- package/core/native/physics/rope.cpp +692 -0
- package/core/native/physics/rope.hpp +215 -0
- package/core/native/physics/rounded_convex.cpp +1229 -0
- package/core/native/physics/rounded_convex.hpp +287 -0
- package/core/native/physics/sdf_geometry.cpp +1821 -0
- package/core/native/physics/sdf_geometry.hpp +474 -0
- package/core/native/physics/soft_body.cpp +1449 -0
- package/core/native/physics/soft_body.hpp +328 -0
- package/core/native/physics/soft_collision.cpp +1862 -0
- package/core/native/physics/soft_collision.hpp +561 -0
- package/core/native/physics/surface_velocity.cpp +366 -0
- package/core/native/physics/surface_velocity.hpp +243 -0
- package/core/native/physics/topology.cpp +357 -39
- package/core/native/physics/topology.hpp +97 -6
- package/core/native/physics/tracks.cpp +1179 -0
- package/core/native/physics/tracks.hpp +404 -0
- package/core/native/physics/vehicle.cpp +629 -0
- package/core/native/physics/vehicle.hpp +191 -0
- package/core/native/physics/voxel_cooking.cpp +1929 -0
- package/core/native/physics/voxel_cooking.hpp +395 -0
- package/core/native/physics/world.cpp +5290 -854
- package/core/native/physics/world.hpp +796 -24
- package/core/native/physics/world_abi.cpp +3840 -306
- package/core/native/physics/world_abi.hpp +530 -10
- package/core/native/physics/world_digest_visitor.hpp +277 -0
- package/core/native/physics/world_strong_digest.hpp +557 -0
- package/core/native/physics2d/ccd.cpp +1302 -0
- package/core/native/physics2d/ccd.hpp +141 -0
- package/core/native/physics2d/checkpoint_memory.hpp +349 -0
- package/core/native/physics2d/clock_primitives.hpp +138 -0
- package/core/native/physics2d/commands.cpp +174 -28
- package/core/native/physics2d/commands.hpp +3 -1
- package/core/native/physics2d/compound.cpp +581 -0
- package/core/native/physics2d/compound.hpp +248 -0
- package/core/native/physics2d/contour.cpp +325 -0
- package/core/native/physics2d/contour.hpp +143 -0
- package/core/native/physics2d/frame_scope.hpp +124 -0
- package/core/native/physics2d/joint_phases.hpp +93 -0
- package/core/native/physics2d/joints.cpp +587 -150
- package/core/native/physics2d/joints.hpp +5 -0
- package/core/native/physics2d/memory_private.hpp +125 -0
- package/core/native/physics2d/owned_abi.cpp +1354 -879
- package/core/native/physics2d/owned_abi.hpp +190 -52
- package/core/native/physics2d/phase_test_hooks.hpp +17 -0
- package/core/native/physics2d/physics2d.cpp +2073 -120
- package/core/native/physics2d/physics2d.hpp +154 -2
- package/core/native/physics2d/queries.cpp +1055 -79
- package/core/native/physics2d/queries.hpp +71 -5
- package/core/native/physics2d/world.cpp +1313 -353
- package/core/native/physics2d/world.hpp +124 -13
- package/core/native/sha256/sha256_compress_unsigned.hpp +68 -0
- package/core/native/sha256/sha256_fips_constants.hpp +24 -0
- package/core/native/sha256/sha256_length.hpp +56 -0
- package/core/native/sha256/sha256_memo.hpp +48 -0
- package/core/native/sha256/sha256_sink.hpp +234 -0
- package/core/physics2d-owned.d.ts +466 -126
- package/core/runtime.d.ts +192 -19
- package/core/scripts/build-native.mjs +34 -0
- package/core/scripts/build-wasm-physics.mjs +272 -23
- package/core/scripts/extended-physics-profile.mjs +634 -0
- package/core/scripts/generate-physics2d-vectors.mjs +59 -0
- package/core/src/kinetix-deterministic-math.d.ts +2 -0
- package/core/src/kinetix-deterministic-math.mjs +513 -27
- package/core/src/kinetix-owned-runtime-adapter.mjs +788 -0
- package/core/src/kinetix-runtime-adapter-utils.mjs +54 -6
- package/core/src/kinetix-runtime-contract.mjs +55 -9
- package/core/src/kinetix-runtime-identity.mjs +12 -1
- package/core/src/kinetix-session-config.mjs +7 -2
- package/core/src/kinetix-state-report.mjs +36 -0
- package/core/src/physics/abi-constants.mjs +5 -4
- package/core/src/physics/articulation.d.mts +194 -0
- package/core/src/physics/articulation.mjs +1141 -0
- package/core/src/physics/buoyancy.d.mts +143 -0
- package/core/src/physics/buoyancy.mjs +268 -0
- package/core/src/physics/cloth.d.mts +314 -0
- package/core/src/physics/cloth.mjs +1156 -0
- package/core/src/physics/deformable-query.d.mts +217 -0
- package/core/src/physics/deformable-query.mjs +1412 -0
- package/core/src/physics/distance.d.mts +160 -0
- package/core/src/physics/distance.mjs +175 -0
- package/core/src/physics/extended-wasm-instance.d.mts +5 -0
- package/core/src/physics/extended-wasm-instance.mjs +48 -0
- package/core/src/physics/feature-api.d.mts +74 -0
- package/core/src/physics/feature-api.mjs +98 -0
- package/core/src/physics/fracture.d.mts +133 -0
- package/core/src/physics/fracture.mjs +1324 -0
- package/core/src/physics/gear.d.mts +585 -0
- package/core/src/physics/gear.mjs +955 -0
- package/core/src/physics/lag-compensation.d.mts +101 -0
- package/core/src/physics/lag-compensation.mjs +1100 -0
- package/core/src/physics/mass-properties.d.mts +114 -0
- package/core/src/physics/mass-properties.mjs +137 -468
- package/core/src/physics/particles.d.mts +177 -0
- package/core/src/physics/particles.mjs +758 -0
- package/core/src/physics/path-joint.d.mts +171 -0
- package/core/src/physics/path-joint.mjs +1231 -0
- package/core/src/physics/physics-extended-wasm-module.generated.mjs +13 -0
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +48 -0
- package/core/src/physics/physics-wasm-module.generated.mjs +34 -5
- package/core/src/physics/powered-ragdoll.d.mts +188 -0
- package/core/src/physics/powered-ragdoll.mjs +1043 -0
- package/core/src/physics/powertrain.d.mts +260 -0
- package/core/src/physics/powertrain.mjs +621 -0
- package/core/src/physics/pulley.d.mts +98 -0
- package/core/src/physics/pulley.mjs +686 -0
- package/core/src/physics/ragdoll.d.mts +289 -0
- package/core/src/physics/ragdoll.mjs +1323 -0
- package/core/src/physics/rope.d.mts +241 -0
- package/core/src/physics/rope.mjs +319 -0
- package/core/src/physics/rounded-convex.d.mts +328 -0
- package/core/src/physics/rounded-convex.mjs +1404 -0
- package/core/src/physics/sdf-geometry.d.mts +117 -0
- package/core/src/physics/sdf-geometry.mjs +1204 -0
- package/core/src/physics/soft-body.d.mts +144 -0
- package/core/src/physics/soft-body.mjs +1285 -0
- package/core/src/physics/soft-collision.d.mts +651 -0
- package/core/src/physics/soft-collision.mjs +1883 -0
- package/core/src/physics/surface-velocity.d.mts +156 -0
- package/core/src/physics/surface-velocity.mjs +722 -0
- package/core/src/physics/tracks.d.mts +411 -0
- package/core/src/physics/tracks.mjs +1074 -0
- package/core/src/physics/vehicle.d.mts +3 -0
- package/core/src/physics/vehicle.mjs +172 -0
- package/core/src/physics/voxel-cooking.d.mts +219 -0
- package/core/src/physics/voxel-cooking.mjs +1499 -0
- package/core/src/physics/voxel-swept-quad.mjs +110 -0
- package/core/src/physics/wasm-instance.mjs +160 -23
- package/core/src/physics/world.d.mts +62 -0
- package/core/src/physics/world.mjs +1947 -152
- package/core/src/physics2d/body-state.mjs +218 -15
- package/core/src/physics2d/collision.d.mts +52 -0
- package/core/src/physics2d/collision.mjs +234 -0
- package/core/src/physics2d/compound.mjs +454 -0
- package/core/src/physics2d/contour-state.mjs +771 -0
- package/core/src/physics2d/feature-api.d.mts +211 -0
- package/core/src/physics2d/feature-api.mjs +3 -0
- package/core/src/physics2d/fluid-state.mjs +145 -0
- package/core/src/physics2d/joint-state.mjs +1 -1
- package/core/src/physics2d/owned-queries.mjs +3 -1
- package/core/src/physics2d/owned-transport.mjs +268 -122
- package/core/src/physics2d/owned-world.mjs +353 -230
- package/core/src/physics2d/particle-fluid.d.mts +152 -0
- package/core/src/physics2d/particle-fluid.mjs +233 -0
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +27 -10
- package/core/src/physics2d/query-codec.mjs +61 -13
- package/core/src/physics2d/submerged-geometry.d.mts +51 -0
- package/core/src/physics2d/submerged-geometry.mjs +186 -0
- package/core/src/runtime.mjs +23 -0
- package/core/src/shared/bytes.d.mts +2 -0
- package/core/src/shared/bytes.mjs +33 -0
- package/core/src/shared/sha256.d.mts +3 -0
- package/core/src/shared/sha256.mjs +72 -22
- package/core/units.d.ts +50 -0
- package/core/world.d.ts +253 -5
- package/dist/authority-room.d.ts +9 -0
- package/dist/authority-room.js +45 -16
- package/dist/browser.d.ts +6 -5
- package/dist/browser.js +4 -3
- package/dist/cadence.d.ts +7 -0
- package/dist/cadence.js +19 -0
- package/dist/canonical.d.ts +1 -0
- package/dist/canonical.js +3 -0
- package/dist/checksum-policy.d.ts +10 -0
- package/dist/checksum-policy.js +14 -0
- package/dist/collider-cooking-hull.d.ts +18 -0
- package/dist/collider-cooking-hull.js +248 -0
- package/dist/collider-cooking.d.ts +140 -0
- package/dist/collider-cooking.js +794 -0
- package/dist/compat/v5.d.ts +121 -0
- package/dist/compat/v5.js +479 -0
- package/dist/creator.d.ts +7 -6
- package/dist/creator.js +4 -3
- package/dist/game-byte-section.d.ts +36 -0
- package/dist/game-byte-section.js +350 -0
- package/dist/index.d.ts +13 -6
- package/dist/index.js +9 -4
- package/dist/instant-replay.d.ts +27 -2
- package/dist/instant-replay.js +91 -16
- package/dist/lag-compensation3d.js +11 -10
- package/dist/match-log.d.ts +21 -4
- package/dist/match-log.js +92 -9
- package/dist/math.d.ts +2 -0
- package/dist/math.js +1 -0
- package/dist/modules/character-3d.d.ts +16 -1
- package/dist/modules/character-3d.js +42 -5
- package/dist/modules/combat.js +6 -5
- package/dist/movement3d-revision1.d.ts +2 -0
- package/dist/movement3d-revision1.js +973 -0
- package/dist/movement3d.d.ts +53 -3
- package/dist/movement3d.js +917 -247
- package/dist/networked-client.d.ts +15 -0
- package/dist/networked-client.js +378 -105
- package/dist/node.d.ts +3 -2
- package/dist/node.js +2 -1
- package/dist/physics/2d.d.ts +38 -4
- package/dist/physics/2d.js +57 -36
- package/dist/physics/3d.d.ts +755 -111
- package/dist/physics/3d.js +2355 -158
- package/dist/physics/edit-result-graph.d.ts +36 -0
- package/dist/physics/edit-result-graph.js +141 -0
- package/dist/physics/game-codec3d.d.ts +41 -0
- package/dist/physics/game-codec3d.js +544 -0
- package/dist/physics/installed-checkpoint3d.d.ts +13 -0
- package/dist/physics/installed-checkpoint3d.js +120 -0
- package/dist/physics/installed-runtime3d.d.ts +51 -0
- package/dist/physics/installed-runtime3d.js +372 -0
- package/dist/physics/installed-state-commitment3d.d.ts +2 -0
- package/dist/physics/installed-state-commitment3d.js +24 -0
- package/dist/physics/units.d.ts +38 -0
- package/dist/physics/units.js +56 -0
- package/dist/physics/vehicle-state3d.d.ts +93 -0
- package/dist/physics/vehicle-state3d.js +1191 -0
- package/dist/physics/voxel-body-state.d.ts +61 -0
- package/dist/physics/voxel-body-state.js +410 -0
- package/dist/r3f-render-adapter.d.ts +59 -1
- package/dist/r3f-render-adapter.js +137 -2
- package/dist/replay.d.ts +13 -0
- package/dist/replay.js +95 -70
- package/dist/run-room-transport.js +5 -1
- package/dist/runner.d.ts +17 -2
- package/dist/runner.js +472 -84
- package/dist/runtime-cleanup.d.ts +54 -0
- package/dist/runtime-cleanup.js +266 -0
- package/dist/runtime-lease.d.ts +11 -1
- package/dist/runtime-lease.js +23 -10
- package/dist/runtime-room-metadata.d.ts +2 -8
- package/dist/runtime-room-metadata.js +11 -14
- package/dist/runtime-session.d.ts +8 -0
- package/dist/runtime-session.js +222 -58
- package/dist/schema-codegen.js +3 -0
- package/dist/schema-dsl-binary.d.ts +10 -4
- package/dist/schema-dsl-binary.js +375 -76
- package/dist/scratch-pool.d.ts +32 -0
- package/dist/scratch-pool.js +60 -0
- package/dist/sdk-session.d.ts +1 -0
- package/dist/sdk-session.js +4 -0
- package/dist/secret-config.js +2 -60
- package/dist/secret-crypto.js +70 -36
- package/dist/session-snapshot.d.ts +15 -4
- package/dist/session-snapshot.js +35 -33
- package/dist/session-wire.js +14 -22
- package/dist/sparse-set.d.ts +1 -0
- package/dist/sparse-set.js +22 -0
- package/dist/spatial/spatial-grid-3d.d.ts +41 -0
- package/dist/spatial/spatial-grid-3d.js +115 -0
- package/dist/synctest.d.ts +9 -0
- package/dist/synctest.js +106 -17
- package/dist/testing-network.d.ts +2 -0
- package/dist/testing-network.js +122 -18
- package/dist/testing.d.ts +27 -6
- package/dist/testing.js +297 -56
- package/dist/tools/index.d.ts +3 -2
- package/dist/tools/index.js +3 -2
- package/dist/tools/module-certification.d.ts +6 -0
- package/dist/tools/module-certification.js +26 -2
- package/package.json +18 -5
- package/core/scripts/run-box3d-benchmark.mjs +0 -350
- package/core/src/physics/index.mjs +0 -3169
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
#include "extended_abi_core_features.hpp"
|
|
2
|
+
|
|
3
|
+
#include "character.hpp"
|
|
4
|
+
#include "distance.hpp"
|
|
5
|
+
#include "rope.hpp"
|
|
6
|
+
#include "vehicle.hpp"
|
|
7
|
+
|
|
8
|
+
#include <algorithm>
|
|
9
|
+
#include <array>
|
|
10
|
+
#include <cmath>
|
|
11
|
+
#include <cstdint>
|
|
12
|
+
#include <span>
|
|
13
|
+
|
|
14
|
+
namespace {
|
|
15
|
+
|
|
16
|
+
using namespace rundot::kinetix::physics;
|
|
17
|
+
|
|
18
|
+
// Constants from character
|
|
19
|
+
constexpr std::uint32_t kExtCharacterInputStride = kCharacterInputStride;
|
|
20
|
+
constexpr std::uint32_t kExtCharacterConfigStride = kCharacterConfigStride;
|
|
21
|
+
constexpr std::uint32_t kExtCharacterStateStride = kCharacterStateStride;
|
|
22
|
+
constexpr std::uint32_t kExtCharacterHitStride = 9;
|
|
23
|
+
constexpr std::uint32_t kExtCharacterShapeStride = 6;
|
|
24
|
+
|
|
25
|
+
// Constants from distance
|
|
26
|
+
constexpr std::uint32_t kExtDistanceInputStride = kDistanceInputStride;
|
|
27
|
+
constexpr std::uint32_t kExtDistanceOptionsStride = kDistanceOptionsStride;
|
|
28
|
+
constexpr std::uint32_t kExtDistanceOutputStride = kDistanceOutputStride;
|
|
29
|
+
|
|
30
|
+
// Constants from rope
|
|
31
|
+
constexpr std::uint32_t kExtRopeNodeStride = kRopeNodeStride;
|
|
32
|
+
constexpr std::uint32_t kExtRopeSegmentStride = kRopeSegmentStride;
|
|
33
|
+
constexpr std::uint32_t kExtRopeBendStride = kRopeBendStride;
|
|
34
|
+
constexpr std::uint32_t kExtRopeTwistStride = kRopeTwistStride;
|
|
35
|
+
constexpr std::uint32_t kExtRopeAnchorStride = kRopeAnchorStride;
|
|
36
|
+
constexpr std::uint32_t kExtRopeParamsStride = kRopeParamsStride;
|
|
37
|
+
constexpr std::uint32_t kExtRopeBreakEventStride = kRopeBreakEventStride;
|
|
38
|
+
|
|
39
|
+
// Constants from vehicle
|
|
40
|
+
constexpr std::uint32_t kExtVehicleWheelStride = vehicle::kVehicleWheelStride;
|
|
41
|
+
constexpr std::uint32_t kExtVehicleContactStride = vehicle::kVehicleContactStride;
|
|
42
|
+
constexpr std::uint32_t kExtVehicleChassisStride = 14;
|
|
43
|
+
constexpr std::uint32_t kExtVehicleSurfaceStride = 23;
|
|
44
|
+
constexpr std::uint32_t kExtVehicleTriangleStride = 13;
|
|
45
|
+
constexpr std::uint32_t kExtVehicleComparisonStride = 43;
|
|
46
|
+
constexpr std::uint32_t kMaxExtVehicleTriangles = 2048;
|
|
47
|
+
|
|
48
|
+
// Fixed memory storage to avoid any heap allocation in vehicle query paths
|
|
49
|
+
static std::array<vehicle::TriangleDef, kMaxExtVehicleTriangles> g_extVehicleTriangles{};
|
|
50
|
+
|
|
51
|
+
inline vehicle::WheelConfig decodeWheelConfig(const double* w) {
|
|
52
|
+
vehicle::WheelConfig wheel{};
|
|
53
|
+
wheel.localAnchor = {w[0], w[1], w[2]};
|
|
54
|
+
wheel.suspensionDir = {w[3], w[4], w[5]};
|
|
55
|
+
wheel.suspensionRestLength = w[6];
|
|
56
|
+
wheel.suspensionMaxTravel = w[7];
|
|
57
|
+
wheel.radius = w[8];
|
|
58
|
+
wheel.stiffness = w[9];
|
|
59
|
+
wheel.damping = w[10];
|
|
60
|
+
wheel.curbClimbLimit = w[11];
|
|
61
|
+
return wheel;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
inline vehicle::ChassisPose decodeChassisPose(const double* c) {
|
|
65
|
+
vehicle::ChassisPose chassis{};
|
|
66
|
+
chassis.position = {c[0], c[1], c[2]};
|
|
67
|
+
chassis.orientation = {c[3], c[4], c[5], c[6]};
|
|
68
|
+
chassis.linearVel = {c[7], c[8], c[9]};
|
|
69
|
+
chassis.angularVel = {c[10], c[11], c[12]};
|
|
70
|
+
chassis.mass = c[13];
|
|
71
|
+
return chassis;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
inline std::int32_t decodeSurfaceTarget(
|
|
75
|
+
const double* s,
|
|
76
|
+
const double* triangleData,
|
|
77
|
+
std::uint32_t triangleCount,
|
|
78
|
+
vehicle::SurfaceQueryTarget& surface) {
|
|
79
|
+
surface.kind = static_cast<vehicle::SurfaceKind>(static_cast<std::uint32_t>(s[0]));
|
|
80
|
+
surface.planeHeight = s[1];
|
|
81
|
+
surface.planeNormal = {s[2], s[3], s[4]};
|
|
82
|
+
surface.materialId = static_cast<std::int32_t>(s[5]);
|
|
83
|
+
surface.friction = s[6];
|
|
84
|
+
surface.restitution = s[7];
|
|
85
|
+
surface.curbBaseHeight = s[8];
|
|
86
|
+
surface.curbStepHeight = s[9];
|
|
87
|
+
surface.curbEdgeCoord = s[10];
|
|
88
|
+
surface.curbAxisZ = s[11] > 0.5;
|
|
89
|
+
|
|
90
|
+
surface.groundBody.bodyIndex = static_cast<std::int32_t>(s[12]);
|
|
91
|
+
surface.groundBody.kind = static_cast<std::uint32_t>(s[13]);
|
|
92
|
+
surface.groundBody.position = {s[14], s[15], s[16]};
|
|
93
|
+
surface.groundBody.linearVel = {s[17], s[18], s[19]};
|
|
94
|
+
surface.groundBody.angularVel = {s[20], s[21], s[22]};
|
|
95
|
+
surface.triangles = {};
|
|
96
|
+
|
|
97
|
+
if (surface.kind == vehicle::SurfaceKind::TriangleMesh && triangleData != nullptr && triangleCount > 0) {
|
|
98
|
+
if (triangleCount > kMaxExtVehicleTriangles) {
|
|
99
|
+
return -2; // Exceeded static triangle buffer capacity
|
|
100
|
+
}
|
|
101
|
+
for (std::uint32_t i = 0; i < triangleCount; ++i) {
|
|
102
|
+
const double* t = triangleData + i * kExtVehicleTriangleStride;
|
|
103
|
+
vehicle::TriangleDef& tri = g_extVehicleTriangles[i];
|
|
104
|
+
tri.a = {t[0], t[1], t[2]};
|
|
105
|
+
tri.b = {t[3], t[4], t[5]};
|
|
106
|
+
tri.c = {t[6], t[7], t[8]};
|
|
107
|
+
tri.triangleId = static_cast<std::int32_t>(t[9]);
|
|
108
|
+
tri.materialId = static_cast<std::int32_t>(t[10]);
|
|
109
|
+
tri.friction = t[11];
|
|
110
|
+
tri.restitution = t[12];
|
|
111
|
+
}
|
|
112
|
+
surface.triangles = std::span<const vehicle::TriangleDef>(g_extVehicleTriangles.data(), triangleCount);
|
|
113
|
+
}
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
inline void encodeWheelContact(const vehicle::WheelContact& c, double* out) {
|
|
118
|
+
out[0] = c.grounded ? 1.0 : 0.0;
|
|
119
|
+
out[1] = c.compression;
|
|
120
|
+
out[2] = c.contactPoint.x;
|
|
121
|
+
out[3] = c.contactPoint.y;
|
|
122
|
+
out[4] = c.contactPoint.z;
|
|
123
|
+
out[5] = c.contactNormal.x;
|
|
124
|
+
out[6] = c.contactNormal.y;
|
|
125
|
+
out[7] = c.contactNormal.z;
|
|
126
|
+
out[8] = c.hitDistance;
|
|
127
|
+
out[9] = static_cast<double>(c.bodyIndex);
|
|
128
|
+
out[10] = static_cast<double>(c.triangleIndex);
|
|
129
|
+
out[11] = static_cast<double>(c.materialId);
|
|
130
|
+
out[12] = c.friction;
|
|
131
|
+
out[13] = c.restitution;
|
|
132
|
+
out[14] = c.isCurbContact ? 1.0 : 0.0;
|
|
133
|
+
out[15] = c.curbHeight;
|
|
134
|
+
out[16] = c.suspensionForce.x;
|
|
135
|
+
out[17] = c.suspensionForce.y;
|
|
136
|
+
out[18] = c.suspensionForce.z;
|
|
137
|
+
out[19] = c.groundReactionForce.y;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
inline void encodeComparison(const vehicle::RayVsSweepComparison& comp, double* out) {
|
|
141
|
+
encodeWheelContact(comp.rayContact, out);
|
|
142
|
+
encodeWheelContact(comp.sweepContact, out + kExtVehicleContactStride);
|
|
143
|
+
out[40] = comp.sweepDetectedEarlier ? 1.0 : 0.0;
|
|
144
|
+
out[41] = comp.potholeBridged ? 1.0 : 0.0;
|
|
145
|
+
out[42] = comp.compressionDelta;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
} // namespace
|
|
149
|
+
|
|
150
|
+
extern "C" {
|
|
151
|
+
|
|
152
|
+
// ---------------------------------------------------------------------------
|
|
153
|
+
// Core Features Module ABI Version
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
std::uint32_t rundot_kinetix_ext_core_features_abi_version() {
|
|
156
|
+
return 1;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
// Kinematic Character Controller (K01)
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
std::uint32_t rundot_kinetix_ext_character_abi_version() {
|
|
163
|
+
return rundot_kinetix_physics_character_abi_version();
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
std::uint32_t rundot_kinetix_ext_character_config_stride() {
|
|
167
|
+
return kExtCharacterConfigStride;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
std::uint32_t rundot_kinetix_ext_character_config_size() {
|
|
171
|
+
return kExtCharacterConfigStride;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
std::uint32_t rundot_kinetix_ext_character_input_stride() {
|
|
175
|
+
return kExtCharacterInputStride;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
std::uint32_t rundot_kinetix_ext_character_input_size() {
|
|
179
|
+
return kExtCharacterInputStride;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
std::uint32_t rundot_kinetix_ext_character_state_stride() {
|
|
183
|
+
return kExtCharacterStateStride;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
std::uint32_t rundot_kinetix_ext_character_state_size() {
|
|
187
|
+
return kExtCharacterStateStride;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
std::uint32_t rundot_kinetix_ext_character_hit_stride() {
|
|
191
|
+
return kExtCharacterHitStride;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
std::uint32_t rundot_kinetix_ext_character_hit_size() {
|
|
195
|
+
return kExtCharacterHitStride;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
std::uint32_t rundot_kinetix_ext_character_shape_stride() {
|
|
199
|
+
return kExtCharacterShapeStride;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
std::uint32_t rundot_kinetix_ext_character_shape_size() {
|
|
203
|
+
return kExtCharacterShapeStride;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
std::uint32_t rundot_kinetix_ext_character_stride() {
|
|
207
|
+
return kExtCharacterConfigStride;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
std::uint32_t rundot_kinetix_ext_character_size() {
|
|
211
|
+
return kExtCharacterConfigStride;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
std::int32_t rundot_kinetix_ext_character_step(
|
|
215
|
+
const double* bodyData,
|
|
216
|
+
std::uint32_t bodyCount,
|
|
217
|
+
const double* inputData,
|
|
218
|
+
const double* configData,
|
|
219
|
+
double* stateData) {
|
|
220
|
+
return rundot_kinetix_physics_character_step(
|
|
221
|
+
bodyData, bodyCount, inputData, configData, stateData);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
std::int32_t rundot_kinetix_ext_character_reset(double* stateData) {
|
|
225
|
+
if (stateData == nullptr) return -1;
|
|
226
|
+
for (std::uint32_t i = 0; i < kExtCharacterStateStride; ++i) {
|
|
227
|
+
stateData[i] = 0.0;
|
|
228
|
+
}
|
|
229
|
+
stateData[8] = 1.0; // groundNormal.y = 1.0
|
|
230
|
+
stateData[11] = -1.0; // groundBodyIndex = -1
|
|
231
|
+
return 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
std::int32_t rundot_kinetix_ext_character_init_config(double* configData) {
|
|
235
|
+
if (configData == nullptr) return -1;
|
|
236
|
+
configData[0] = 0.0; // up.x
|
|
237
|
+
configData[1] = 1.0; // up.y
|
|
238
|
+
configData[2] = 0.0; // up.z
|
|
239
|
+
configData[3] = 0.7853981633974483; // maxSlopeAngle (45 deg)
|
|
240
|
+
configData[4] = 0.35; // stepHeight
|
|
241
|
+
configData[5] = 0.02; // skinWidth
|
|
242
|
+
configData[6] = 1e-4; // minStepDistance
|
|
243
|
+
configData[7] = 0.1; // groundProbeDistance
|
|
244
|
+
configData[8] = 0.0; // gravity.x
|
|
245
|
+
configData[9] = -9.81; // gravity.y
|
|
246
|
+
configData[10] = 0.0; // gravity.z
|
|
247
|
+
configData[11] = 4.0; // maxSlideIterations
|
|
248
|
+
configData[12] = 1.0; // snapToGround
|
|
249
|
+
configData[13] = static_cast<double>(ShapeKind::Capsule); // shapeKind
|
|
250
|
+
configData[14] = 0.4; // radius
|
|
251
|
+
configData[15] = 0.6; // halfHeight
|
|
252
|
+
configData[16] = static_cast<double>(0xffffffffU); // collisionMask
|
|
253
|
+
configData[17] = -1.0; // excludedBodyIndex
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
std::int32_t rundot_kinetix_ext_character_init_state(double* stateData) {
|
|
258
|
+
return rundot_kinetix_ext_character_reset(stateData);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Shape Distance and Closest Point Queries (Q05)
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
std::uint32_t rundot_kinetix_ext_distance_abi_version() {
|
|
265
|
+
return rundot_kinetix_physics_distance_abi_version();
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
std::uint32_t rundot_kinetix_ext_distance_input_stride() {
|
|
269
|
+
return kExtDistanceInputStride;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
std::uint32_t rundot_kinetix_ext_distance_input_size() {
|
|
273
|
+
return kExtDistanceInputStride;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
std::uint32_t rundot_kinetix_ext_distance_options_stride() {
|
|
277
|
+
return kExtDistanceOptionsStride;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
std::uint32_t rundot_kinetix_ext_distance_options_size() {
|
|
281
|
+
return kExtDistanceOptionsStride;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
std::uint32_t rundot_kinetix_ext_distance_output_stride() {
|
|
285
|
+
return kExtDistanceOutputStride;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
std::uint32_t rundot_kinetix_ext_distance_output_size() {
|
|
289
|
+
return kExtDistanceOutputStride;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
std::uint32_t rundot_kinetix_ext_distance_result_stride() {
|
|
293
|
+
return kExtDistanceOutputStride;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
std::uint32_t rundot_kinetix_ext_distance_result_size() {
|
|
297
|
+
return kExtDistanceOutputStride;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
std::uint32_t rundot_kinetix_ext_distance_shape_stride() {
|
|
301
|
+
return kExtDistanceInputStride;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
std::uint32_t rundot_kinetix_ext_distance_shape_size() {
|
|
305
|
+
return kExtDistanceInputStride;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
std::uint32_t rundot_kinetix_ext_distance_stride() {
|
|
309
|
+
return kExtDistanceInputStride;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
std::uint32_t rundot_kinetix_ext_distance_size() {
|
|
313
|
+
return kExtDistanceInputStride;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
std::int32_t rundot_kinetix_ext_distance_shape_distance(
|
|
317
|
+
const double* shapeAData,
|
|
318
|
+
const double* shapeBData,
|
|
319
|
+
const double* geometryData,
|
|
320
|
+
std::uint32_t geometryCount,
|
|
321
|
+
const double* optionsData,
|
|
322
|
+
double* outputData) {
|
|
323
|
+
return rundot_kinetix_physics_shape_distance(
|
|
324
|
+
shapeAData, shapeBData, geometryData, geometryCount, optionsData, outputData);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
std::int32_t rundot_kinetix_ext_distance_point_distance(
|
|
328
|
+
const double* pointData,
|
|
329
|
+
const double* shapeData,
|
|
330
|
+
const double* geometryData,
|
|
331
|
+
std::uint32_t geometryCount,
|
|
332
|
+
const double* optionsData,
|
|
333
|
+
double* outputData) {
|
|
334
|
+
return rundot_kinetix_physics_point_distance(
|
|
335
|
+
pointData, shapeData, geometryData, geometryCount, optionsData, outputData);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
std::int32_t rundot_kinetix_ext_distance_solve(
|
|
339
|
+
const double* shapeAData,
|
|
340
|
+
const double* shapeBData,
|
|
341
|
+
const double* geometryData,
|
|
342
|
+
std::uint32_t geometryCount,
|
|
343
|
+
const double* optionsData,
|
|
344
|
+
double* outputData) {
|
|
345
|
+
return rundot_kinetix_physics_shape_distance(
|
|
346
|
+
shapeAData, shapeBData, geometryData, geometryCount, optionsData, outputData);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
std::int32_t rundot_kinetix_ext_distance_reset(double* outputData) {
|
|
350
|
+
if (outputData == nullptr) return -1;
|
|
351
|
+
for (std::uint32_t i = 0; i < kExtDistanceOutputStride; ++i) {
|
|
352
|
+
outputData[i] = 0.0;
|
|
353
|
+
}
|
|
354
|
+
return 0;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// ---------------------------------------------------------------------------
|
|
358
|
+
// Elastic Rods and Strands (A01 / A08)
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
std::uint32_t rundot_kinetix_ext_rope_abi_version() {
|
|
361
|
+
return rundot_kinetix_physics_rope_abi_version();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
std::uint32_t rundot_kinetix_ext_rope_node_stride() {
|
|
365
|
+
return kExtRopeNodeStride;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
std::uint32_t rundot_kinetix_ext_rope_node_size() {
|
|
369
|
+
return kExtRopeNodeStride;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
std::uint32_t rundot_kinetix_ext_rope_segment_stride() {
|
|
373
|
+
return kExtRopeSegmentStride;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
std::uint32_t rundot_kinetix_ext_rope_segment_size() {
|
|
377
|
+
return kExtRopeSegmentStride;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
std::uint32_t rundot_kinetix_ext_rope_bend_stride() {
|
|
381
|
+
return kExtRopeBendStride;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
std::uint32_t rundot_kinetix_ext_rope_bend_size() {
|
|
385
|
+
return kExtRopeBendStride;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
std::uint32_t rundot_kinetix_ext_rope_twist_stride() {
|
|
389
|
+
return kExtRopeTwistStride;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
std::uint32_t rundot_kinetix_ext_rope_twist_size() {
|
|
393
|
+
return kExtRopeTwistStride;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
std::uint32_t rundot_kinetix_ext_rope_anchor_stride() {
|
|
397
|
+
return kExtRopeAnchorStride;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
std::uint32_t rundot_kinetix_ext_rope_anchor_size() {
|
|
401
|
+
return kExtRopeAnchorStride;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
std::uint32_t rundot_kinetix_ext_rope_params_stride() {
|
|
405
|
+
return kExtRopeParamsStride;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
std::uint32_t rundot_kinetix_ext_rope_params_size() {
|
|
409
|
+
return kExtRopeParamsStride;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
std::uint32_t rundot_kinetix_ext_rope_break_event_stride() {
|
|
413
|
+
return kExtRopeBreakEventStride;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
std::uint32_t rundot_kinetix_ext_rope_break_event_size() {
|
|
417
|
+
return kExtRopeBreakEventStride;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
std::uint32_t rundot_kinetix_ext_rope_max_nodes() {
|
|
421
|
+
return kRopeMaxNodes;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
std::uint32_t rundot_kinetix_ext_rope_max_segments() {
|
|
425
|
+
return kRopeMaxSegments;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
std::uint32_t rundot_kinetix_ext_rope_max_anchors() {
|
|
429
|
+
return kRopeMaxAnchors;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
std::uint32_t rundot_kinetix_ext_rope_max_break_events() {
|
|
433
|
+
return kRopeMaxBreakEvents;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
std::uint32_t rundot_kinetix_ext_rope_stride() {
|
|
437
|
+
return kExtRopeNodeStride;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
std::uint32_t rundot_kinetix_ext_rope_size() {
|
|
441
|
+
return kExtRopeNodeStride;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
std::uint32_t rundot_kinetix_ext_rope_probe_size() {
|
|
445
|
+
return rundot_rope_probe_size();
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
const double* rundot_kinetix_ext_rope_probe(std::uint32_t scenario) {
|
|
449
|
+
return rundot_rope_probe(scenario);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
std::int32_t rundot_kinetix_ext_rope_step(
|
|
453
|
+
double* nodeData,
|
|
454
|
+
std::uint32_t nodeCount,
|
|
455
|
+
double* segmentData,
|
|
456
|
+
std::uint32_t segmentCount,
|
|
457
|
+
double* bendData,
|
|
458
|
+
std::uint32_t bendCount,
|
|
459
|
+
double* twistData,
|
|
460
|
+
std::uint32_t twistCount,
|
|
461
|
+
double* anchorData,
|
|
462
|
+
std::uint32_t anchorCount,
|
|
463
|
+
double* bodyData,
|
|
464
|
+
std::uint32_t bodyCount,
|
|
465
|
+
const double* paramsData,
|
|
466
|
+
double* breakEventsData,
|
|
467
|
+
std::uint32_t* breakEventCount,
|
|
468
|
+
double dt) {
|
|
469
|
+
return rundot_kinetix_physics_rope_step(
|
|
470
|
+
nodeData, nodeCount,
|
|
471
|
+
segmentData, segmentCount,
|
|
472
|
+
bendData, bendCount,
|
|
473
|
+
twistData, twistCount,
|
|
474
|
+
anchorData, anchorCount,
|
|
475
|
+
bodyData, bodyCount,
|
|
476
|
+
paramsData,
|
|
477
|
+
breakEventsData, breakEventCount,
|
|
478
|
+
dt);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
std::int32_t rundot_kinetix_ext_rope_solve(
|
|
482
|
+
double* nodeData,
|
|
483
|
+
std::uint32_t nodeCount,
|
|
484
|
+
double* segmentData,
|
|
485
|
+
std::uint32_t segmentCount,
|
|
486
|
+
double* bendData,
|
|
487
|
+
std::uint32_t bendCount,
|
|
488
|
+
double* twistData,
|
|
489
|
+
std::uint32_t twistCount,
|
|
490
|
+
double* anchorData,
|
|
491
|
+
std::uint32_t anchorCount,
|
|
492
|
+
double* bodyData,
|
|
493
|
+
std::uint32_t bodyCount,
|
|
494
|
+
const double* paramsData,
|
|
495
|
+
double* breakEventsData,
|
|
496
|
+
std::uint32_t* breakEventCount,
|
|
497
|
+
double dt) {
|
|
498
|
+
return rundot_kinetix_physics_rope_step(
|
|
499
|
+
nodeData, nodeCount,
|
|
500
|
+
segmentData, segmentCount,
|
|
501
|
+
bendData, bendCount,
|
|
502
|
+
twistData, twistCount,
|
|
503
|
+
anchorData, anchorCount,
|
|
504
|
+
bodyData, bodyCount,
|
|
505
|
+
paramsData,
|
|
506
|
+
breakEventsData, breakEventCount,
|
|
507
|
+
dt);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
std::int32_t rundot_kinetix_ext_rope_reset(
|
|
511
|
+
double* nodeData,
|
|
512
|
+
std::uint32_t nodeCount) {
|
|
513
|
+
if (nodeData == nullptr) return -1;
|
|
514
|
+
for (std::uint32_t i = 0; i < nodeCount; ++i) {
|
|
515
|
+
const std::uint32_t offset = i * kExtRopeNodeStride;
|
|
516
|
+
nodeData[offset + 3] = nodeData[offset + 0];
|
|
517
|
+
nodeData[offset + 4] = nodeData[offset + 1];
|
|
518
|
+
nodeData[offset + 5] = nodeData[offset + 2];
|
|
519
|
+
nodeData[offset + 6] = 0.0;
|
|
520
|
+
nodeData[offset + 7] = 0.0;
|
|
521
|
+
nodeData[offset + 8] = 0.0;
|
|
522
|
+
}
|
|
523
|
+
return 0;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// ---------------------------------------------------------------------------
|
|
527
|
+
// Vehicle Suspension and Wheels (V01)
|
|
528
|
+
// ---------------------------------------------------------------------------
|
|
529
|
+
std::uint32_t rundot_kinetix_ext_vehicle_abi_version() {
|
|
530
|
+
return rundot_kinetix_vehicle_abi_version();
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
std::uint32_t rundot_kinetix_ext_vehicle_wheel_stride() {
|
|
534
|
+
return kExtVehicleWheelStride;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
std::uint32_t rundot_kinetix_ext_vehicle_wheel_size() {
|
|
538
|
+
return kExtVehicleWheelStride;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
std::uint32_t rundot_kinetix_ext_vehicle_contact_stride() {
|
|
542
|
+
return kExtVehicleContactStride;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
std::uint32_t rundot_kinetix_ext_vehicle_contact_size() {
|
|
546
|
+
return kExtVehicleContactStride;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
std::uint32_t rundot_kinetix_ext_vehicle_chassis_stride() {
|
|
550
|
+
return kExtVehicleChassisStride;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
std::uint32_t rundot_kinetix_ext_vehicle_chassis_size() {
|
|
554
|
+
return kExtVehicleChassisStride;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
std::uint32_t rundot_kinetix_ext_vehicle_surface_stride() {
|
|
558
|
+
return kExtVehicleSurfaceStride;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
std::uint32_t rundot_kinetix_ext_vehicle_surface_size() {
|
|
562
|
+
return kExtVehicleSurfaceStride;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
std::uint32_t rundot_kinetix_ext_vehicle_triangle_stride() {
|
|
566
|
+
return kExtVehicleTriangleStride;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
std::uint32_t rundot_kinetix_ext_vehicle_triangle_size() {
|
|
570
|
+
return kExtVehicleTriangleStride;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
std::uint32_t rundot_kinetix_ext_vehicle_comparison_stride() {
|
|
574
|
+
return kExtVehicleComparisonStride;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
std::uint32_t rundot_kinetix_ext_vehicle_comparison_size() {
|
|
578
|
+
return kExtVehicleComparisonStride;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
std::uint32_t rundot_kinetix_ext_vehicle_max_triangles() {
|
|
582
|
+
return kMaxExtVehicleTriangles;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
std::uint32_t rundot_kinetix_ext_vehicle_stride() {
|
|
586
|
+
return kExtVehicleContactStride;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
std::uint32_t rundot_kinetix_ext_vehicle_size() {
|
|
590
|
+
return kExtVehicleContactStride;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
std::int32_t rundot_kinetix_ext_vehicle_raycast_wheel(
|
|
594
|
+
const double* wheelData,
|
|
595
|
+
const double* chassisData,
|
|
596
|
+
const double* surfaceData,
|
|
597
|
+
const double* triangleData,
|
|
598
|
+
std::uint32_t triangleCount,
|
|
599
|
+
double dt,
|
|
600
|
+
double* outputContact) {
|
|
601
|
+
if (wheelData == nullptr || chassisData == nullptr || surfaceData == nullptr || outputContact == nullptr) {
|
|
602
|
+
return -1;
|
|
603
|
+
}
|
|
604
|
+
const auto wheel = decodeWheelConfig(wheelData);
|
|
605
|
+
const auto chassis = decodeChassisPose(chassisData);
|
|
606
|
+
vehicle::SurfaceQueryTarget surface{};
|
|
607
|
+
const std::int32_t status = decodeSurfaceTarget(surfaceData, triangleData, triangleCount, surface);
|
|
608
|
+
if (status != 0) return status;
|
|
609
|
+
|
|
610
|
+
const auto contact = vehicle::raycastWheelContact(wheel, chassis, surface, dt);
|
|
611
|
+
encodeWheelContact(contact, outputContact);
|
|
612
|
+
return 0;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
std::int32_t rundot_kinetix_ext_vehicle_shapecast_wheel(
|
|
616
|
+
const double* wheelData,
|
|
617
|
+
const double* chassisData,
|
|
618
|
+
const double* surfaceData,
|
|
619
|
+
const double* triangleData,
|
|
620
|
+
std::uint32_t triangleCount,
|
|
621
|
+
double dt,
|
|
622
|
+
double* outputContact) {
|
|
623
|
+
if (wheelData == nullptr || chassisData == nullptr || surfaceData == nullptr || outputContact == nullptr) {
|
|
624
|
+
return -1;
|
|
625
|
+
}
|
|
626
|
+
const auto wheel = decodeWheelConfig(wheelData);
|
|
627
|
+
const auto chassis = decodeChassisPose(chassisData);
|
|
628
|
+
vehicle::SurfaceQueryTarget surface{};
|
|
629
|
+
const std::int32_t status = decodeSurfaceTarget(surfaceData, triangleData, triangleCount, surface);
|
|
630
|
+
if (status != 0) return status;
|
|
631
|
+
|
|
632
|
+
const auto contact = vehicle::shapecastWheelContact(wheel, chassis, surface, dt);
|
|
633
|
+
encodeWheelContact(contact, outputContact);
|
|
634
|
+
return 0;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
std::int32_t rundot_kinetix_ext_vehicle_evaluate_wheel(
|
|
638
|
+
const double* wheelData,
|
|
639
|
+
const double* chassisData,
|
|
640
|
+
const double* surfaceData,
|
|
641
|
+
const double* triangleData,
|
|
642
|
+
std::uint32_t triangleCount,
|
|
643
|
+
double dt,
|
|
644
|
+
double* outputContact) {
|
|
645
|
+
if (wheelData == nullptr || chassisData == nullptr || surfaceData == nullptr || outputContact == nullptr) {
|
|
646
|
+
return -1;
|
|
647
|
+
}
|
|
648
|
+
const auto wheel = decodeWheelConfig(wheelData);
|
|
649
|
+
const auto chassis = decodeChassisPose(chassisData);
|
|
650
|
+
vehicle::SurfaceQueryTarget surface{};
|
|
651
|
+
const std::int32_t status = decodeSurfaceTarget(surfaceData, triangleData, triangleCount, surface);
|
|
652
|
+
if (status != 0) return status;
|
|
653
|
+
|
|
654
|
+
const auto contact = vehicle::evaluateWheelContact(wheel, chassis, surface, dt);
|
|
655
|
+
encodeWheelContact(contact, outputContact);
|
|
656
|
+
return 0;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
std::int32_t rundot_kinetix_ext_vehicle_compare_wheel(
|
|
660
|
+
const double* wheelData,
|
|
661
|
+
const double* chassisData,
|
|
662
|
+
const double* surfaceData,
|
|
663
|
+
const double* triangleData,
|
|
664
|
+
std::uint32_t triangleCount,
|
|
665
|
+
double dt,
|
|
666
|
+
double* outputComparison) {
|
|
667
|
+
if (wheelData == nullptr || chassisData == nullptr || surfaceData == nullptr || outputComparison == nullptr) {
|
|
668
|
+
return -1;
|
|
669
|
+
}
|
|
670
|
+
const auto wheel = decodeWheelConfig(wheelData);
|
|
671
|
+
const auto chassis = decodeChassisPose(chassisData);
|
|
672
|
+
vehicle::SurfaceQueryTarget surface{};
|
|
673
|
+
const std::int32_t status = decodeSurfaceTarget(surfaceData, triangleData, triangleCount, surface);
|
|
674
|
+
if (status != 0) return status;
|
|
675
|
+
|
|
676
|
+
const auto comp = vehicle::compareRayVersusWheelSweep(wheel, chassis, surface, dt);
|
|
677
|
+
encodeComparison(comp, outputComparison);
|
|
678
|
+
return 0;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
std::int32_t rundot_kinetix_ext_vehicle_solve_wheel(
|
|
682
|
+
const double* wheelData,
|
|
683
|
+
const double* chassisData,
|
|
684
|
+
const double* surfaceData,
|
|
685
|
+
const double* triangleData,
|
|
686
|
+
std::uint32_t triangleCount,
|
|
687
|
+
double dt,
|
|
688
|
+
double* outputContact) {
|
|
689
|
+
return rundot_kinetix_ext_vehicle_evaluate_wheel(
|
|
690
|
+
wheelData, chassisData, surfaceData, triangleData, triangleCount, dt, outputContact);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
std::int32_t rundot_kinetix_ext_vehicle_step(
|
|
694
|
+
const double* wheelData,
|
|
695
|
+
const double* chassisData,
|
|
696
|
+
const double* surfaceData,
|
|
697
|
+
const double* triangleData,
|
|
698
|
+
std::uint32_t triangleCount,
|
|
699
|
+
double dt,
|
|
700
|
+
double* outputContact) {
|
|
701
|
+
return rundot_kinetix_ext_vehicle_evaluate_wheel(
|
|
702
|
+
wheelData, chassisData, surfaceData, triangleData, triangleCount, dt, outputContact);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
std::int32_t rundot_kinetix_ext_vehicle_reset_contact(double* contactData) {
|
|
706
|
+
if (contactData == nullptr) return -1;
|
|
707
|
+
for (std::uint32_t i = 0; i < kExtVehicleContactStride; ++i) {
|
|
708
|
+
contactData[i] = 0.0;
|
|
709
|
+
}
|
|
710
|
+
return 0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
} // extern "C"
|