Skip to content

Commit

Permalink
Fixed point cloud laggs
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanJansson committed May 18, 2017
1 parent dc2e0dd commit 95971e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Binary file modified unityproject/LidarSimulator/Assets/Scenes/FinalScene.unity
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ void Start()
isEnabled = true;
LidarMenu.OnPassLidarValuesToPointCloud += UpdateSpecs;
PlayButton.OnPlayToggled += ToggleCloud;

Debug.Log("start");
}

void OnDestroy()
Expand Down Expand Up @@ -206,7 +208,6 @@ public void Pause()
LidarSensor.OnScanned -= OnUpdatePoints;
LidarSensor.NewRotationEvent -= NewLap;
isEnabled = false;

if(clearOnPause)
{
foreach (var entity in particleSystemIdMap)
Expand All @@ -230,6 +231,7 @@ public void Pause()
/// </summary>
public void UpdateSpecs(int numberOfLasers, float rotationSpeed, float rotationAnglePerStep)
{
/*
this.rotationSpeed = 1.0f / rotationSpeed;
Debug.Log("sag");
Pause();
Expand All @@ -251,11 +253,12 @@ public void UpdateSpecs(int numberOfLasers, float rotationSpeed, float rotationA
maxParticlesPerCloud = 10000;
particleSize = 0.01f;
}

maxParticleSystems = (int)Mathf.Ceil((float)maxNumParticlesPerLap / (float)maxParticlesPerCloud);
//maxParticleSystems = (int)Mathf.Ceil((float)maxNumParticlesPerLap / (float)maxParticlesPerCloud);
Debug.Log("MaxSystems: " + maxParticleSystems);
CreateNeededParticleSystems();
Play();

*/

}

Expand All @@ -266,6 +269,7 @@ public void UpdateSpecs(int numberOfLasers, float rotationSpeed, float rotationA
private void CreateNeededParticleSystems()
{
int currentNumberOfSystems = particleSystemIdMap.Count;
Debug.Log("No: " + currentNumberOfSystems);

if (currentNumberOfSystems < maxParticleSystems)
{
Expand Down Expand Up @@ -327,4 +331,5 @@ private void OnEnable()
{
Play();
}

}

0 comments on commit 95971e9

Please sign in to comment.