Skip to content

Commit bd2aba6

Browse files
author
Ricardo J. Mendez
committed
Tweaking Lightning, added parameters
1 parent 1bc2cc3 commit bd2aba6

12 files changed

+10
-8
lines changed

Assets/Scenes/Lightning.unity

100755100644
166 Bytes
Binary file not shown.

Assets/Sources/LightningBolt.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public class LightningBolt : MonoBehaviour
1616
public Light startLight;
1717
public Light endLight;
1818

19+
public float MaxForce = 5;
20+
public float MaxSpeed = 10;
21+
1922
Perlin noise;
2023
float oneOverZigs;
2124

@@ -38,8 +41,8 @@ void Start()
3841

3942
vehicles[i].Mass = 0.1f;
4043
vehicles[i].Radius = 0.05f;
41-
vehicles[i].MaxSpeed = 10f;
42-
vehicles[i].MaxForce = 5;
44+
vehicles[i].MaxSpeed = MaxSpeed;
45+
vehicles[i].MaxForce = MaxForce;
4346
vehicles[i].PreviousStrength = 0.5f;
4447
vehicles[i].NextStrength = 1.0f;
4548

@@ -58,7 +61,7 @@ void Start()
5861

5962
void Update ()
6063
{
61-
//RandomizeParticlePositions(false);
64+
//RandomizeParticlePositions(true);
6265

6366
for(int i = particles.Length - 1; i >= 0; i--)
6467
{
@@ -101,10 +104,6 @@ void RandomizeParticlePositions(int startIndex, bool isOffset)
101104
float timex = Time.time * speed * 0.1365143f;
102105
float timey = Time.time * speed * 1.21688f;
103106
float timez = Time.time * speed * 2.5564f;
104-
/*
105-
float timey = Time.time * speed * 0.21688f;
106-
float timez = Time.time * speed * 0.2564f;
107-
*/
108107

109108
for (int i = startIndex; i < particles.Length; i++)
110109
{
@@ -113,7 +112,10 @@ void RandomizeParticlePositions(int startIndex, bool isOffset)
113112
Vector3 offset = new Vector3(noise.Noise(timex + position.x, timex + position.y, timex + position.z),
114113
noise.Noise(timey + position.x, timey + position.y, timey + position.z),
115114
noise.Noise(timez + position.x, timez + position.y, timez + position.z));
116-
position += (offset * scale * ((float)i * oneOverZigs));
115+
116+
Vector3 displacement = isOffset ? offset * scale
117+
: (offset * scale * ((float)i * oneOverZigs));
118+
position += displacement;
117119

118120
particles[i].position = position;
119121
particles[i].color = Color.white;

Library/MonoManager.asset

-520 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

Library/ScriptAssemblies/Assembly - CSharp.dll.mdb

100755100644
40 Bytes
Binary file not shown.

Library/assetDatabase3

0 Bytes
Binary file not shown.

Library/cache/1e/1e07ff5cad11c56fa000929bcf342b59

100755100644
72 Bytes
Binary file not shown.

Library/cache/50/504ad79087be6461bae7b6dc1f235001

100755100644
0 Bytes
Binary file not shown.

Library/cache/ec/eca4676b703b14106b9c090f675ef2ef

100755100644
0 Bytes
Binary file not shown.

Library/metadata/1e/1e07ff5cad11c56fa000929bcf342b59

100755100644
File mode changed.

Library/metadata/50/504ad79087be6461bae7b6dc1f235001

100755100644
File mode changed.

Library/metadata/ec/eca4676b703b14106b9c090f675ef2ef

100755100644
File mode changed.

0 commit comments

Comments
 (0)