Fix many RemoteParticipants in Unity
This commit is contained in:
parent
7f063e0434
commit
ad8e587f65
@ -49,8 +49,7 @@ namespace RoboidControl.Unity {
|
||||
Participant participant = remoteParticipant.AddComponent<Participant>();
|
||||
participant.coreParticipant = e.participant;
|
||||
participant.coreParticipant.component = participant;
|
||||
ParticipantUDP participantUDP = participant.coreParticipant as ParticipantUDP;
|
||||
if (participantUDP != null) {
|
||||
if (participant.coreParticipant is ParticipantUDP participantUDP) {
|
||||
participant.ipAddress = participantUDP.ipAddress;
|
||||
participant.port = participantUDP.port;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace RoboidControl {
|
||||
public override byte Serialize(ref byte[] buffer) {
|
||||
if (poseType == 0)
|
||||
return 0;
|
||||
#if DEBUG
|
||||
#if DEBUG2
|
||||
System.Console.WriteLine($"Send PoseMsg [{this.networkId}/{this.thingId}] {this.poseType}");
|
||||
#endif
|
||||
|
||||
|
@ -325,12 +325,13 @@ namespace RoboidControl {
|
||||
if (sender == null) {
|
||||
sender = AddParticipant(ipAddress, endPoint.Port, this);
|
||||
sender.isRemote = true;
|
||||
}
|
||||
|
||||
|
||||
UpdateEvent e = new() {
|
||||
messageId = NetworkIdMsg.Id,
|
||||
participant = sender
|
||||
};
|
||||
}
|
||||
this.updateQueue.Enqueue(e);
|
||||
|
||||
ReceiveData(data, sender);
|
||||
@ -457,6 +458,7 @@ namespace RoboidControl {
|
||||
// Console.Write($"Dropped {thing.id}");
|
||||
thing.parent = null;
|
||||
}
|
||||
|
||||
ForwardMessage(sender, msg);
|
||||
}
|
||||
|
||||
@ -479,6 +481,8 @@ namespace RoboidControl {
|
||||
Thing thing = sender.Get(msg.thingId);
|
||||
if (thing != null)
|
||||
thing.name = msg.name;
|
||||
|
||||
ForwardMessage(sender, msg);
|
||||
}
|
||||
|
||||
protected virtual void Process(Participant sender, ModelUrlMsg msg) {
|
||||
@ -489,6 +493,8 @@ namespace RoboidControl {
|
||||
Thing thing = sender.Get(msg.thingId);
|
||||
if (thing != null)
|
||||
thing.modelUrl = msg.url;
|
||||
|
||||
ForwardMessage(sender, msg);
|
||||
}
|
||||
|
||||
protected virtual void Process(Participant sender, PoseMsg msg) {
|
||||
@ -511,6 +517,8 @@ namespace RoboidControl {
|
||||
thing.linearVelocity = msg.linearVelocity;
|
||||
if ((msg.poseType & PoseMsg.Pose_AngularVelocity) != 0)
|
||||
thing.angularVelocity = msg.angularVelocity;
|
||||
|
||||
ForwardMessage(sender, msg);
|
||||
}
|
||||
|
||||
protected virtual void Process(Participant sender, BinaryMsg msg) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user