Skip to content

Commit cfd5cd2

Browse files
committed
tweak code and parameters.
1 parent afebcbd commit cfd5cd2

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

Assets/Boid-PureECS-Sample2/Boid-PureECS-Sample2.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ MonoBehaviour:
264264
m_Script: {fileID: 11500000, guid: 3a72ae1ccff8f4775a6dcc7ec025faec, type: 3}
265265
m_Name:
266266
m_EditorClassIdentifier:
267-
boidCount: 100
267+
boidCount: 300
268268
boidScale: {x: 0.1, y: 0.1, z: 0.3}
269269
param: {fileID: 11400000, guid: b4d1e89f21b5e48e1a9817346dd475fe, type: 2}
270270
rendererComponent: {fileID: 1099352407}

Assets/Boid-PureECS-Sample2/Bootstrap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void Start()
5656
{
5757
var entity = manager.CreateEntity(archetype);
5858
var rot = random.NextQuaternionRotation();
59-
manager.SetComponentData(entity, new Position() { Value = random.NextFloat3(1f) });
59+
manager.SetComponentData(entity, new Position() { Value = math.normalize(random.NextFloat3(1f)) });
6060
manager.SetComponentData(entity, new Rotation() { Value = rot });
6161
manager.SetComponentData(entity, new Scale() { Value = new float3(boidScale.x, boidScale.y, boidScale.z) });
6262
manager.SetComponentData(entity, new Velocity() { Value = math.mul(rot, new float3(0, 0, 1)) * param.initSpeed });

Assets/Boid-PureECS-Sample2/ComponentSystem.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ protected override void OnUpdate()
3636
for (int j = 0; j < data.Length; ++j)
3737
{
3838
if (i == j) continue;
39+
3940
float3 pos1 = data.positions[j].Value;
4041
var to = pos1 - pos0;
4142
var dist = math.length(to);
43+
4244
if (dist < distThresh)
4345
{
4446
var dir = math.normalize(to);

Assets/Common/Boid.asset

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ MonoBehaviour:
1515
minSpeed: 2
1616
maxSpeed: 5
1717
neighborDistance: 1
18-
neighborFov: 90
18+
neighborFov: 120
1919
separationWeight: 5
2020
wallScale: 5
2121
wallDistance: 2

0 commit comments

Comments
 (0)