diff --git a/Assets/Boids/BoidsNativeArray.cs b/Assets/Boids/BoidsNativeArray.cs index 1d155dd..b54b56b 100644 --- a/Assets/Boids/BoidsNativeArray.cs +++ b/Assets/Boids/BoidsNativeArray.cs @@ -82,7 +82,7 @@ public void Execute(int id) { avgPos += tgtPos; } } - accel[id] += (avgSpr * weights.x + avgVel * weights.y + avgPos * weights.z) / n; + accel[id] += avgSpr / n * weights.x + avgVel / n * weights.y + (avgPos / n - pos) * weights.z; } } @@ -114,8 +114,8 @@ public void Execute() { [SerializeField] protected GameObject prefab; [SerializeField] protected Vector3 areaSize; [SerializeField] protected float distThreshold; - [SerializeField] Vector2 velThreshold; - [SerializeField] Vector3 simWeight; + [SerializeField] protected Vector2 velThreshold; + [SerializeField] protected Vector3 simWeight; protected Transform[] objs; protected NativeArray pos, vel, acc; protected TransformAccessArray trs; diff --git a/Assets/Boids/BoidsNativeList.cs b/Assets/Boids/BoidsNativeList.cs index af8251f..124ea3f 100644 --- a/Assets/Boids/BoidsNativeList.cs +++ b/Assets/Boids/BoidsNativeList.cs @@ -81,7 +81,8 @@ public void Execute(int id) { avgPos += tgtPos; } } - accel[id] += (avgSpr * weights.x + avgVel * weights.y + avgPos * weights.z) / n; + + accel[id] += avgSpr / n * weights.x + avgVel / n * weights.y + (avgPos / n - pos) * weights.z; } } @@ -113,8 +114,8 @@ public void Execute() { [SerializeField] protected GameObject prefab; [SerializeField] protected Vector3 areaSize; [SerializeField] protected float distThreshold; - [SerializeField] Vector2 velThreshold; - [SerializeField] Vector3 simWeight; + [SerializeField] protected Vector2 velThreshold; + [SerializeField] protected Vector3 simWeight; [SerializeField] KeyCode add = KeyCode.A; [SerializeField] KeyCode remove = KeyCode.R; protected NativeList pos, vel, acc; diff --git a/Assets/Boids/Demo.unity b/Assets/Boids/Demo.unity index e387fc7..31c57ef 100644 --- a/Assets/Boids/Demo.unity +++ b/Assets/Boids/Demo.unity @@ -335,10 +335,10 @@ MonoBehaviour: m_EditorClassIdentifier: initNum: 10 prefab: {fileID: 4950830921021070585, guid: 81910fc2cc865994ba8a1da7c3b6a0f6, type: 3} - areaSize: {x: 20, y: 20, z: 20} + areaSize: {x: 25, y: 25, z: 25} distThreshold: 5 velThreshold: {x: 0, y: 4} - simWeight: {x: 8, y: 6, z: 1} + simWeight: {x: 4, y: 0.8, z: 0.3} add: 97 remove: 114 --- !u!4 &1361161912 @@ -400,7 +400,7 @@ MonoBehaviour: m_EditorClassIdentifier: num: 3000 prefab: {fileID: 4950830921021070585, guid: 81910fc2cc865994ba8a1da7c3b6a0f6, type: 3} - areaSize: {x: 20, y: 20, z: 20} + areaSize: {x: 25, y: 25, z: 25} distThreshold: 5 velThreshold: {x: 0, y: 4} - simWeight: {x: 8, y: 6, z: 1} + simWeight: {x: 4, y: 0.8, z: 0.3} diff --git a/Packages/manifest.json b/Packages/manifest.json index d8dbe3a..d65ff0b 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,13 +1,13 @@ { "dependencies": { - "com.unity.burst": "1.1.2", + "com.unity.burst": "1.3.0-preview.10", "com.unity.collab-proxy": "1.2.16", "com.unity.ext.nunit": "1.0.0", - "com.unity.ide.rider": "1.1.0", - "com.unity.ide.vscode": "1.1.3", - "com.unity.jobs": "0.2.1-preview.3", + "com.unity.ide.rider": "1.1.4", + "com.unity.ide.vscode": "1.1.4", + "com.unity.jobs": "0.2.9-preview.15", "com.unity.mathematics": "1.1.0", - "com.unity.test-framework": "1.1.3", + "com.unity.test-framework": "1.1.13", "com.unity.textmeshpro": "2.0.1", "com.unity.timeline": "1.2.6", "com.unity.ugui": "1.0.0", diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 9b0e50b..c7d3fa9 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.3.0f1 -m_EditorVersionWithRevision: 2019.3.0f1 (ffacea4b84e7) +m_EditorVersion: 2019.3.11f1 +m_EditorVersionWithRevision: 2019.3.11f1 (ceef2d848e70)