Comments (9)
networked entities are synchronized if you own them. To temporarily disable, I guess you could set the owner to "scene" or anything that is not your NAF.clientId
.
But I didn't quite understand your use case, it seems you want a participant to control, so taking ownership and send the changes but forbid other participants to take ownership make changes?
from networked-aframe.
Thanks, we have components which control child elements:
<a-entity networked>
<a-entity id="controlNode" ... controlchilds="">
<a-entity id="child1" ... >
</a-entity>
<a-entity id="child2" ... >
</a-entity>
</a-entity>
</a-entity>
We want the host to control the remote "controlNode", but not the child of this node, because controlNode already controls them without synchronization.
from networked-aframe.
All that is bit abstract. The above code is missing the networked template and schema. And I have no idea what controlschilds is doing.
Did I answer your question about the ownership? If not, please provide a more complete example to discuss it further.
from networked-aframe.
controlchilds is an aframe component that combines a-entities to construct an element such as a canopy. For example, it controls the position and size of the child nodes such as the height of the beam(s). If we write controlchilds="width:2; height:2.2", then controlchild sets this value for some children.
When the controlchilds component is synchronized in the remote client, it is not necessary to synchronize the already controlled children.
We want to specify that some children (and some attributes) are temporarily not synchronized because we know that other elements are already doing so.
from networked-aframe.
Maybe you can add controlchilds in the networked schema (with the correct selector), and add a prop synced:boolean to controlchilds. When a networked entity in synced, it will call the update method in your controlchilds component, if synced is false, then don't do any update of your children.
from networked-aframe.
Thanks, we did it this way:
AFRAME.components.networked.Component.prototype.updateNetworkedComponents = function(components) {
for (var componentIndex = 0, l = this.componentSchemas.length; componentIndex < l; componentIndex++) {
var componentData = components[componentIndex];
var componentSchema = this.componentSchemas[componentIndex];
var componentElement = this.getCachedElement(componentIndex);
if (this.skipComponentUpdate) {
/*
Some kind of check to skip updates for specific elements and components.
To allow manual component updates the bufferInfo entry needs to be removed.
*/
continue;
}
(...)
Additional we have to remove the bufferInfo for the element. Otherwise it is in the remote client not possible to manipulate the component.
It looks like this is one solution. When there is a way to avoid the messages from the host that may be a better solution. What do you think?
But in the meantime it works this way.
Many thanks!
from networked-aframe.
This is hacky but yeah that works and it avoid sending any changes at all. My proposed solution was still sending changes but ignored on the receiving side.
If you want to disable sending update at the component level, you can define your own function to use in requiresNetworkUpdate for the component in your networked schema, like the vectorRequiresUpdate function, see https://github.com/networked-aframe/networked-aframe#syncing-components-optimization
from networked-aframe.
This is what I have in mind with a synced prop that you add to your controlchilds component (not tested):
// Same function as in networked.js but it is not exported so we need to define again.
// You also need to define deepEqual (see DeepEquals.js:equal)
function defaultRequiresUpdate() {
let cachedData = null;
return (newData) => {
if (cachedData === null || !deepEqual(cachedData, newData)) {
cachedData = AFRAME.utils.clone(newData);
return true;
}
return false;
};
}
const componentRequiresUpdate = () => {
return data => {
return data.synced && defaultRequiresUpdate(data)
};
};
// schema
{
template: '#my-template',
components: [
{
component: 'controlchilds',
requiresNetworkUpdate: componentRequiresUpdate
}
]
}
from networked-aframe.
Ok, thanks, we will test it.
from networked-aframe.
Related Issues (20)
- Be in networked aframe but not be there? HOT 4
- didn't manage to get hand tracking working HOT 5
- User in new position with each refresh?
- Add ability to add networked entity to non-networked parent HOT 7
- Share Screen Issue HOT 1
- stuck with npm i on a RPi Zero HOT 5
- Write a "how it works" documentation HOT 12
- Not a issue but really need some help. Trying to add pre-text pharses above the character. HOT 1
- networked-video-source should respect the video aspect ratio HOT 1
- Create a web component to show connected users HOT 10
- [networked-audio-zone] Private audio zone HOT 1
- https for audio? HOT 1
- Audio chat example low volume? HOT 10
- Deletion of a component in the NAF schema is not replicated HOT 2
- Updated state not being replicated to new joiners to a scene HOT 2
- Fix networked-video-source has a bad color space with a-frame v1.5.0
- networked-hand-controls issues with aframe-v1.5.0 HOT 2
- Alternative using binary instead of json for updates HOT 3
- Networked fullbody tracking HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from networked-aframe.