Hey!
I have a question regarding the .listen method for coloseus.js client.
So, the thing is, that I send the current position & rotation to the server, which looks something like this:
serverRoom.send({
action: 'entity:transform:update',
detail: {
id: mesh.id,
transformMatrix: [
meshTransform.position.x,
meshTransform.position.y,
meshTransform.position.z,
meshTransform.rotation.x,
meshTransform.rotation.y,
meshTransform.rotation.z,
meshTransform.rotation.w,
],
},
});
my room's state looks something like this:
public onInit (options) {
this.setState({
entities: {}, // key_id: { id: 1, transformMatrix: [0,0,0,0,0,0,0] }
});
}
Now, I want to listen for changes of other entities like that:
serverRoom.listen('entities/:id/transformMatrix', (change: DataChange) => {
// listen for changes
});
But that doesn't seem to work (it only fires for the first add operation & the remove operation; It doesn't ever fire the replace operation), if the transformMatrix variable is an array. My temporary workaround is, to set it to a string, and also send the transformMatrix as a string.
Is there a way I could get the array inside the serverRoom.listen()
method?