Added remote mouth support

This commit is contained in:
Pascal Serrarens 2025-04-24 12:07:33 +02:00
parent fd8215cc7e
commit a6d6ec1948
4 changed files with 15 additions and 8 deletions

View File

@ -66,7 +66,7 @@ namespace RoboidControl.Unity {
/// </summary> /// </summary>
protected virtual void Update() { protected virtual void Update() {
if (core == null) { if (core == null) {
Debug.Log("Core thing is gone, self destruct in 0 seconds..."); // Debug.Log("Core thing is gone, self destruct in 0 seconds...");
Destroy(this); Destroy(this);
return; return;
} }
@ -95,7 +95,7 @@ namespace RoboidControl.Unity {
core.nameChanged = false; core.nameChanged = false;
} }
if (core.hierarchyChanged) { if (core.hierarchyChanged) {
Debug.Log("Parent changed"); // Debug.Log("Parent changed");
if (core.parent == null) if (core.parent == null)
this.transform.SetParent(null, true); this.transform.SetParent(null, true);
else else

View File

@ -42,7 +42,7 @@ namespace RoboidControl.Unity {
rb.isKinematic = true; rb.isKinematic = true;
SphereCollider collider = gameObj.AddComponent<SphereCollider>(); SphereCollider collider = gameObj.AddComponent<SphereCollider>();
collider.radius = 0.01f; collider.radius = 0.02f;
collider.isTrigger = true; collider.isTrigger = true;
if (gameObj.transform.parent != null && gameObj.transform.localPosition.magnitude > 0) { if (gameObj.transform.parent != null && gameObj.transform.localPosition.magnitude > 0) {
@ -54,10 +54,15 @@ namespace RoboidControl.Unity {
} }
private void OnTriggerEnter(Collider other) { private void OnTriggerEnter(Collider other) {
if (other.isTrigger) Debug.Log("Touch?");
if (other.isTrigger) {
Debug.Log($" was trigger {other.name}");
return; return;
if (this.transform.root == other.transform.root) }
if (this.transform.root == other.transform.root) {
Debug.Log($" was myself {other.name}");
return; return;
}
Debug.Log($"*** {this} Touch"); Debug.Log($"*** {this} Touch");
this.coreSensor.touchedSomething = true; this.coreSensor.touchedSomething = true;

View File

@ -46,7 +46,9 @@ namespace RoboidControl {
if (this.isIsolated == false) { if (this.isIsolated == false) {
// Send to all other participants // Send to all other participants
foreach (Participant participant in Participant.participants) { //foreach (Participant participant in Participant.participants) {
for (int participantIx = 0; participantIx < Participant.participants.Count; participantIx++) {
Participant participant = Participant.participants[participantIx];
if (participant == null || participant == this) if (participant == null || participant == this)
continue; continue;
@ -85,7 +87,7 @@ namespace RoboidControl {
Console.WriteLine($"Could not find parent [{msg.networkId}/{msg.parentId}]"); Console.WriteLine($"Could not find parent [{msg.networkId}/{msg.parentId}]");
} }
else { else {
Console.Write($"Dropped {thing.id}"); // Console.Write($"Dropped {thing.id}");
thing.parent = null; thing.parent = null;
} }
} }

View File

@ -90,7 +90,7 @@ namespace RoboidControl {
this.id = thingId; this.id = thingId;
this.type = thingType; this.type = thingType;
this.networkId = networkId; this.networkId = networkId;
Console.Write($"New thing added to {owner}"); // Console.Write($"New thing added to {owner}");
this.owner.Add(this); this.owner.Add(this);
InvokeNewThing(this); InvokeNewThing(this);
} }