Sync multiple children
This commit is contained in:
parent
58f2f4adce
commit
51546db8f2
@ -36,8 +36,11 @@ void NetworkSync::ReceiveNetworkId() {
|
||||
printf("_Received network Id %d\n", this->networkId);
|
||||
#endif
|
||||
PublishModel(roboid);
|
||||
if (roboid->childCount > 0)
|
||||
PublishRelativeThing(roboid->GetChild(0), true);
|
||||
for (unsigned char childIx = 0; childIx < roboid->childCount; childIx++) {
|
||||
Thing* child = roboid->GetChild(childIx);
|
||||
if (child != nullptr)
|
||||
PublishRelativeThing(child, true);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkSync::NewObject(InterestingThing* thing) {
|
||||
@ -70,14 +73,14 @@ void NetworkSync::PublishRelativeThing(Thing* thing, bool recurse) {
|
||||
SendSpherical(buffer, &ix, thing->position);
|
||||
SendBuffer(ix);
|
||||
|
||||
// delay(100);
|
||||
PublishModel(thing);
|
||||
|
||||
// delay(1000);
|
||||
if (recurse) {
|
||||
Thing* child = thing->GetChild(0);
|
||||
if (child != nullptr)
|
||||
PublishRelativeThing(child, true);
|
||||
for (unsigned char childIx = 0; childIx < thing->childCount; childIx++) {
|
||||
Thing* child = thing->GetChild(childIx);
|
||||
if (child != nullptr)
|
||||
PublishRelativeThing(child, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,9 +149,11 @@ void NetworkSync::SendPose(Roboid* roboid, bool recurse) {
|
||||
SendBuffer(ix);
|
||||
|
||||
if (recurse) {
|
||||
Thing* child = roboid->GetChild(0);
|
||||
if (child != nullptr)
|
||||
SendPose(child, true);
|
||||
for (unsigned char childIx = 0; childIx < roboid->childCount; childIx++) {
|
||||
Thing* child = roboid->GetChild(childIx);
|
||||
if (child != nullptr)
|
||||
SendPose(child, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,10 +167,11 @@ void NetworkSync::SendPose(Thing* thing, bool recurse) {
|
||||
SendBuffer(ix);
|
||||
|
||||
if (recurse) {
|
||||
// delay(10);
|
||||
Thing* child = thing->GetChild(0);
|
||||
if (child != nullptr)
|
||||
SendPose(child, true);
|
||||
for (unsigned char childIx = 0; childIx < thing->childCount; childIx++) {
|
||||
Thing* child = thing->GetChild(childIx);
|
||||
if (child != nullptr)
|
||||
SendPose(thing->GetChild(childIx), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user