API

Function computeDeformedPositionToRef

  • Writes the deformed MESH-LOCAL position of a single vertex into out, applying the mesh's active morph targets and skeletal skinning for the current frame.

    Reads the CPU mirrors that the animation tick maintains every frame (_cpuPositions, morphTargets.weights/targets, skeleton.boneMatrices), so the result matches what the GPU renders this frame — with no GPU readback and no latency.

    Mirrors the structure of Babylon.js core's GetTransformedPosition: the result is in mesh-local space. A caller computing a hotspot barycentric-blends several deformed vertices and then applies mesh.worldMatrix to the single blended point (blending is affine, so blend-then-transform equals transform-then-blend). This is the primitive used to track hotspot/annotation positions on animated meshes.

    Lives in its own module (rather than in the picker's main chunk) so that a scene using hotspots does not drag the GPU picker in, and a picking scene does not drag this in. It reuses the shared morph/skin primitives in deformation-math.js, so there is no duplicated math.

    Parameters

    • mesh: Mesh

      The mesh to query. Must have CPU position data (_cpuPositions).

    • vertexIndex: number

      Index of the vertex within the mesh's position buffer.

    • out: Vec3

      Destination mesh-local position, written in place (zero-allocation).

    Returns boolean

    true on success; false if the mesh has no CPU positions or vertexIndex is out of range.