Hey guys,
I’ve made a script which draws a line from 1 planet to another - but after the line is finished, there is an invisible setPosition(0,0,0)… Here is a Screenshot which explains my problem:
(The big circle is at 0,0,0)
Hey guys,
I’ve made a script which draws a line from 1 planet to another - but after the line is finished, there is an invisible setPosition(0,0,0)… Here is a Screenshot which explains my problem:
(The big circle is at 0,0,0)
line = wayStart.AddComponent();
line.SetVertexCount (500);
line.SetWidth(0.1F, 0.1F);
line.useWorldSpace = false;
line.SetPosition (0, currentCam.knownSolarSystems[solarSystemSource].Planets[planetSource].Planet.transform.position);
wayCalculateObjectStart.transform.position = currentCam.knownSolarSystems[solarSystemSource].Planets[planetSource].Planet.transform.position;
wayCalculateObjectEnd.transform.position = currentCam.knownSolarSystems[solarSystem].Planets[planet].Planet.transform.position;
while(hitObject == false) {
wayCalculateObjectEnd.transform.position = currentCam.knownSolarSystems[solarSystem].Planets[planet].positionIn(cTime);
float currentDistance = Vector3.Distance(wayCalculateObjectStart.transform.position, wayCalculateObjectEnd.transform.position);
float step = currentDistance * ((float)1 / 100);
completeDistance += step;
cTime += step / 0.1f;
wayCalculateObjectStart.transform.position = Vector3.MoveTowards(wayCalculateObjectStart.transform.position, wayCalculateObjectEnd.transform.position, step);
line.SetPosition (i++, wayCalculateObjectStart.transform.position);
Debug.Log(wayCalculateObjectStart.transform.position.x);
if(wayCalculateObjectStart.transform.position == wayCalculateObjectEnd.transform.position)
hitObject = true;
if(i > 400)
break;
}
And I can promise you that not a single time “wayCalculateObjectStart.transform.position” returns a Vector with 0,0,0