GPU mesh queries and selection — engine v14 Check getGPUCapabilities().gpuMeshQueries; refresh Game after a player deployment. Use an editable mesh made by createGPUMesh/importGPUMesh. All commands return Promises; await dependent operations. Coordinates are Unity world coordinates (legacy CS object.pos.x uses the opposite X sign). No source collider is changed. Measure the current mesh, including GPU deformation. var bounds = await getGPUMeshBounds("sheet"); bounds.boundsMin; bounds.boundsMax; bounds.pivot; bounds.validCount; bounds.invalidCount; Finite vertices with coordinates smaller than1e19 are included. No valid vertices returns zero bounds and validCount0; do not treat that as a real point at origin. This query does not automatically change conservative renderer extent. Find where a ray hits the actual deformed triangles. var hit = await raycastGPUMesh("sheet", {x:0,y:10,z:0}, {x:0,y:-1,z:0}); if (hit.hit) { hit.point; hit.normal; hit.distance; hit.index; hit.uv; hit.barycentric; } Optional {maxDistance:10000,backfaces:true}. Direction is normalized; distance is world units. maxDistance must be >0 and <=100000. Backfaces false culls triangles facing away from the ray. normal is geometric winding normal, not a normal-map sample or forcibly oriented toward the ray. UV is the mesh UV before material texture tiling/offset; barycentric{x,y,z} weights triangle vertices0,1,2. Miss: hit=false,index=-1,distance=-1. Transport/invalid arguments reject instead. Index is stable only while topology/order stays the same. Deterministic lower-index choice for equal-distance hits. Query only this mesh, not all scenery or PhysX. Find the nearest surface point, including edges and corners. var nearest = await closestGPUMeshPoint("sheet", {x:4,y:5,z:2}, {maxDistance:20}); Same hit fields as raycast. Returns unsigned distance; does not classify inside vs outside or provide penetration depth. A nearest point is not collision response. Paint or erase local deformation weights without resetting the rest of the mask. await fillGPUBuffer("sheet", "weights", 0); await paintGPUMeshMask("sheet", {x:-1,y:3,z:0}, 1.2, 1, {mode:"add",feather:.5}); await paintGPUMeshMask("sheet", {x:1,y:3,z:0}, 1.2, 1, {mode:"subtract",feather:.5}); await deformGPUMesh("sheet", "inflate", 1); weight0..1. Modes replace/add/subtract; clamp result to0..1. Replace interpolates old weight toward requested weight using brush strength; add/subtract apply weight multiplied by brush strength. Outside brush unchanged. Radius positive <=10000. Feather0 hard edge;1 smooth from center to radius. Default mode replace,feather.5. Options space:"rest" (default) or "current" chooses positions when selecting. A current-space brush can use hit.point directly after raycast on a deformed mesh. Selection is captured once; weights stay attached to vertices as they move. Select a rectangular volume or the opposite region. await maskGPUMeshBox("sheet", {x:0,y:3,z:0}, {x:2,y:2,z:3}, {feather:.4}); Full box dimensions, axis aligned, positive <=20000. Feather0..1/default.25 is a fraction of the box half-size; uses the largest normalized axis distance. Replaces ALL weights. Optional invert:true selects outside, space:"current" uses live shape. Select one side of a plane, with a smooth band if wanted. await maskGPUMeshPlane("sheet", {x:0,y:3,z:0}, {x:1,y:0,z:0}, {feather:.8}); Nonzero normal, normalized internally. Positive half-space receives1, negative0. Here feather is a WORLD-UNIT band centered on the plane (0..10000, default0). Optional invert:true and space:"current". Replaces ALL weights. Apply deformation after setting any selection. Weight0 keeps the vertex at rest, not at its last pose. Reset positions with resetGPUMesh; clear selection with fillGPUBuffer(weights,1). Queries scan the fixed triangles on GPU, reduce there and read only64 bytes back. One query in flight per program. Max65536 vertices/131072 triangles. No BVH yet: use on-demand clicks/measurements, not thousands of rays per frame. Results are a snapshot of the GPU buffer at dispatch, not a collision event or persistent contact. Nonfinite/out-of-range vertices and degenerate triangles are skipped. Nearly parallel rays and tiny degenerate faces are subject to float32 geometric tolerance. No full-population CPU download, PhysX recook, automatic collision response, swept collision detection or two-way force coupling in this batch. Examples: catalog/examples/gpu-select-*.js; source is saved in each demo's editor.