Added wal texutre & minor improvements

This commit is contained in:
Pascal Serrarens 2025-04-24 12:59:05 +02:00
parent a6d6ec1948
commit 3d2374436c
2 changed files with 15 additions and 2 deletions

View File

@ -16,6 +16,8 @@ namespace RoboidControl.Unity {
get => (RoboidControl.TouchSensor)base.core;
}
SphereCollider collider = null;
/// <summary>
/// Start the Unity represention
/// </summary>
@ -24,6 +26,7 @@ namespace RoboidControl.Unity {
participant = FindAnyObjectByType<SiteServer>();
SetCoreThing(new RoboidControl.TouchSensor(participant.site));
}
collider = GetComponent<SphereCollider>();
}
/// <summary>
@ -42,7 +45,7 @@ namespace RoboidControl.Unity {
rb.isKinematic = true;
SphereCollider collider = gameObj.AddComponent<SphereCollider>();
collider.radius = 0.02f;
collider.radius = 0.01f;
collider.isTrigger = true;
if (gameObj.transform.parent != null && gameObj.transform.localPosition.magnitude > 0) {
@ -53,6 +56,16 @@ namespace RoboidControl.Unity {
return component;
}
protected override void Update() {
base.Update();
if (collider.radius == 0.01f &&
this.transform.parent != null && this.transform.localPosition.magnitude > 0
) {
collider.radius = Vector3.Distance(this.transform.position, this.transform.parent.position) / 2;
this.transform.position = (this.transform.position + this.transform.parent.position) / 2;
}
}
private void OnTriggerEnter(Collider other) {
Debug.Log("Touch?");
if (other.isTrigger) {

View File

@ -37,9 +37,9 @@ namespace RoboidControl {
get { return _touchedSomething; }
set {
if (_touchedSomething != value) {
touchUpdated = true;
_touchedSomething = value;
}
touchUpdated = true;
}
}
private bool touchUpdated = false;