Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating synced objects using third party components #88

Closed
msimbao opened this issue Jan 19, 2018 · 5 comments
Closed

updating synced objects using third party components #88

msimbao opened this issue Jan 19, 2018 · 5 comments

Comments

@msimbao
Copy link

msimbao commented Jan 19, 2018

Hi. Your project is awesome and i can't believe all the different stuff you can do with it and the different options it opens up. I wanted to ask if it is possible to continuously update custom entities that are synced using third party components like super-hands or click-drag. I've been trying for a while but can't seem to get the server to update the positions and rotations for the second viewer. Would ownership transfer help with that?

@haydenjameslee
Copy link
Collaborator

Yes its definitely possible to move objects (as long as your client currently owns them) using super-hands. I suspect you are not syncing the correct entity's position and rotation. By default only the top-level entity's position and rotation are synced. If you provide an example showcasing what you think should work I can provide more help. (check out glitch.com for an easy way to make an example).

@msimbao
Copy link
Author

msimbao commented Jan 19, 2018

Hi Hayden. thanks for the quick reply! Here's an example which is just a bare-bones remix of your basic naf glitch example.

https://glitch.com/edit/#!/bio-gas?path=public/index.html

I was trying to sync a box so that it can be dragged by both users or just one and the other is still able to see the action.

@netpro2k
Copy link
Contributor

Note that one tricky bit about super-hands in particular is that aframe-physics-system uses a quaternion component to do its rotation, so you will specifically need to sync that. See https://github.com/mozilla/mr-social-client/blob/experiment/super-hands/src/network-schemas.js#L30

@msimbao
Copy link
Author

msimbao commented Jan 27, 2018

Hi netpro2k, thanks for the response. Adding the quaternion component did help out but apparently the problem was with my code. I just found it and saw that i wasn't adding the progressive-controls component and grabbable components to the correct entities. I was putting them all together but instead had to seperate them.

  <a-entity id="mine" grabbable networked="template:#box-template;showLocalTemplate:true" position="0 1 0" >
 </a-entity>

I'm still having a problem with syncing and the only way it worked was with a glitch in the java o.o (i think the second square brace shouldn't exist at the end)

var boxSchema = {
template: '#box-template',
components: [
"position",
"rotation",
"scale",
"rotation",
"quaternion",
]

    ]
  };
  NAF.schemas.add(boxSchema);

but ill come figure it out. Thanks so much for all the help!

@msimbao msimbao closed this as completed Jan 27, 2018
@netpro2k
Copy link
Contributor

You have rotation in there twice, you actually don't need it at all since the quaternion component actually removes rotation. Also you are correct, there is an extra ]

var boxSchema = {
  template: '#box-template',
  components: [
    "position",
    "scale",
    "quaternion"
  ]
};
NAF.schemas.add(boxSchema);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants