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);
|
printf("_Received network Id %d\n", this->networkId);
|
||||||
#endif
|
#endif
|
||||||
PublishModel(roboid);
|
PublishModel(roboid);
|
||||||
if (roboid->childCount > 0)
|
for (unsigned char childIx = 0; childIx < roboid->childCount; childIx++) {
|
||||||
PublishRelativeThing(roboid->GetChild(0), true);
|
Thing* child = roboid->GetChild(childIx);
|
||||||
|
if (child != nullptr)
|
||||||
|
PublishRelativeThing(child, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::NewObject(InterestingThing* thing) {
|
void NetworkSync::NewObject(InterestingThing* thing) {
|
||||||
@ -70,15 +73,15 @@ void NetworkSync::PublishRelativeThing(Thing* thing, bool recurse) {
|
|||||||
SendSpherical(buffer, &ix, thing->position);
|
SendSpherical(buffer, &ix, thing->position);
|
||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
// delay(100);
|
|
||||||
PublishModel(thing);
|
PublishModel(thing);
|
||||||
|
|
||||||
// delay(1000);
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
Thing* child = thing->GetChild(0);
|
for (unsigned char childIx = 0; childIx < thing->childCount; childIx++) {
|
||||||
|
Thing* child = thing->GetChild(childIx);
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
PublishRelativeThing(child, true);
|
PublishRelativeThing(child, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::PublishModel(Roboid* roboid) {
|
void NetworkSync::PublishModel(Roboid* roboid) {
|
||||||
@ -146,10 +149,12 @@ void NetworkSync::SendPose(Roboid* roboid, bool recurse) {
|
|||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
Thing* child = roboid->GetChild(0);
|
for (unsigned char childIx = 0; childIx < roboid->childCount; childIx++) {
|
||||||
|
Thing* child = roboid->GetChild(childIx);
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
SendPose(child, true);
|
SendPose(child, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkSync::SendPose(Thing* thing, bool recurse) {
|
void NetworkSync::SendPose(Thing* thing, bool recurse) {
|
||||||
@ -162,10 +167,11 @@ void NetworkSync::SendPose(Thing* thing, bool recurse) {
|
|||||||
SendBuffer(ix);
|
SendBuffer(ix);
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
// delay(10);
|
for (unsigned char childIx = 0; childIx < thing->childCount; childIx++) {
|
||||||
Thing* child = thing->GetChild(0);
|
Thing* child = thing->GetChild(childIx);
|
||||||
if (child != nullptr)
|
if (child != nullptr)
|
||||||
SendPose(child, true);
|
SendPose(thing->GetChild(childIx), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user