worldmaking / mischmasch

https://www.alicelab.world/msvr
MIT License
9 stars 1 forks source link

module updates not sent between app instances (module positions) #254

Closed michaelpalumbo closed 11 months ago

michaelpalumbo commented 11 months ago

2 causes identified:

  1. module position/quat is being modified directly, and that app.js is not reading module position values from the patch.document. seems this would need to change in order for incoming module position values to take effect:
// approx line 541 
// apply hand pose to the dragged object:
let m = mat4.multiply(mat4.create(), hand.mat, hand.stateData.objectRelativeMat);
mat4.getTranslation(object.pos, m)
mat4.getRotation(object.quat, m)
  1. the position array for a given module is being updated prior to this.document being modified by Automerge in patch.update(). Therefore, sync messages are not being generated for position updates (because according to automerge, nothing has changed). This one is weird, it's not clear to me why/where this is happening

update: cause 1 is fixed for position data (will repeat solution for quat once cause 2 is fixed)

update 2: a possible solution may be to change the position property for modules from an array to an object with x, y, and z properties. reasoning: automerge sync protocol is funky with detecting changes made to lists.

michaelpalumbo commented 11 months ago

see branch bug/positions

michaelpalumbo commented 11 months ago

findings:

michaelpalumbo commented 11 months ago

to do:

michaelpalumbo commented 11 months ago

this is fixed now. however note that Automerge sync protocol was not able to detect changes to arrays (lists), see https://github.com/automerge/automerge/issues/760