Fix roaming boid

This commit is contained in:
Pascal Serrarens 2026-01-05 11:12:22 +01:00
parent a91bd6dfee
commit 3611de5142
3 changed files with 19 additions and 13 deletions

View File

@ -32,7 +32,6 @@ namespace LinearAlgebra {
}
return new AngleFloat(radians * Rad2Deg);
}
public static AngleFloat Revolutions(float revolutions) {
@ -51,17 +50,11 @@ namespace LinearAlgebra {
return new AngleFloat(revolutions * 360);
}
public float inDegrees {
get { return this.value; }
}
public readonly float inDegrees => this.value;
public float inRadians {
get { return this.value * Deg2Rad; }
}
public float inRevolutions {
get { return this.value / 360.0f; }
}
public readonly float inRadians => this.value * Deg2Rad;
public readonly float inRevolutions => this.value / 360.0f;
public static readonly AngleFloat zero = Degrees(0);
public static readonly AngleFloat deg90 = Degrees(90);
@ -115,6 +108,18 @@ namespace LinearAlgebra {
return a1.value != a2.value;
}
public override readonly bool Equals(object obj) {
if (obj is AngleFloat other) {
return this == other;
}
return false;
}
public override readonly int GetHashCode() {
return this.value.GetHashCode();
}
/// <summary>
/// Tests if the first angle is greater than the second
/// </summary>

View File

@ -89,6 +89,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_MaskInteraction: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!136 &8702527963799169118
CapsuleCollider:
@ -176,4 +177,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 92f34a5e4027a1dc39efd8ce63cf6aba, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::NanoBrainComponent
defaultBrain: {fileID: 11400000, guid: fc1a4800a8c531eb4855b436bc9084ae, type: 2}
defaultBrain: {fileID: 11400000, guid: af8d90b8b4b9dcad7837130c4143d91c, type: 2}

View File

@ -43,7 +43,7 @@ public class Boid : MonoBehaviour {
//Debug.DrawRay(this.transform.position, this.transform.TransformDirection(localPosition), Color.magenta);
int thingId = neighbour.GetInstanceID();
boidReceptor.ProcessStimulus(thingId, localPosition);
boidReceptor?.ProcessStimulus(thingId, localPosition);
}
}