gkjohnson / closed-chain-ik-js

A generalized inverse kinematics solver that supports closed chains for parallel kinematics systems, dynamic reconfiguration, and arbitrary joint configuration based on damped least squares error minimization techniques

Home Page:https://gkjohnson.github.io/closed-chain-ik-js/dist/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WorkerSolver: Update worker solver to use a basic ArrayBuffer rather than SharedArrayBuffer

gkjohnson opened this issue · comments

SharedArrayBuffers are not always available on all platforms including Chrome on Android

Not available in Safari, either, but they have been reenabled behind a flag in the latest technology preview. And it sounds like there's a plan to get them enabled again on Chrome Android.

Trading the buffers back and forth would be a bit complicated and performance may suffer a bit, as well. We could just transfer results the IK is converged? Or the solver can continue to iterate in the background while the buffer is transferred, applied, and then immediately transferred back.

Instead we should automatically fall back ArrayBuffers and swap them back and forth:

const useSharedArrayBuffer = ( typeof SharedArrayBuffer ) !== 'undefined';