Hello, I’m setting up the color of my avatar using the PlayerColor.ts as a reference. Currently I’m able to update the color of the avatar, but I’d like to ask how can I replicate the color that my user has selected to the rest of the users. Thanks in advance.
Thanks for your help. I’m an experienced c# dev, but a total noob with TS and JS. I’ve implemented the IModel interface on my class and I’m trying to send the gameobject this way: this.context.connection.send(this.connId, this.gameObject as IModel, SendQueue.Immediate);
uncaught range error: maximum call stack size exceeded
/node_modules/.vite/deps/chunk-BYWKJQSH.js?cf5a31f5:5110:14
at JSON.stringify ()
at Mesh.toJSON(https:192.168.3.8:3000/…
Thanks for your response. I’ve created my AvatarColorUpdate type. Before sending the message, I’m converting my THREE.Color into a number with bit shifting. Now the error message is not being displayed anymore, but the color isn’t being updated over the network
const packedColor = ((col.r * 255) << 16) | ((col.g * 255) << 8) | (col.b * 255);
let myData = new AvatarColorUpdate(this.connId, packedColor);
Do you alos subscribe to the event? Insteads of “this.connId” you need to define a event key (e.g “change-player-color”) and then listen to the event to apply it (if(myData.guid === this.playerGuid) ...)
I wrote the code above on the onEnable method, and I’m sending my information when a button is clicked: ```Typescript
let myData = new AvatarColorUpdate(this.connId, packedColor);
console.log("send: “+myData.connId+” and "+myData.color);
this.context.connection.send(“avatarColorUpdate”, myData, SendQueue.Immediate);
the color of the avatar is being set up on the Quest browser and works fine there, but is not being replicated to the desktop browser. I can see myself moving the avatar (using quest controllers) on the desktop browser, but the color remains the same