why in this part step is 0 all the time? in this part:
step = movingToRadiusSpeed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position,
radiusPosition, step);
if Time.deltaTime is changing all the time why step is 0 all the time? i used a break point and step is 0 all the time.
and i checked the variable movingToRadiusSpeed is declared once in the top without being initialized to 0 and is used once only in this part of code.
private void Update()
{
if (target != null)
{
if (dc != null)
{
radiusPosition = new Vector3(target.position.x,
target.position.y + dc.yRadius, target.position.z + dc.xRadius);
radius = dc.xRadius;
}
else
{
radiusPosition = new Vector3(target.position.x, target.position.y, target.position.z + radius);
}
}
if (moveToRadius == false)
{
if (target != null)
{
transform.RotateAround(target.position, axis, rotatingSpeed * Time.deltaTime);
}
if (randomHeight)
{
t += Time.deltaTime;
if (t > delay)
{
prevHeight = setRandomHeight;
setRandomHeight = Random.Range(lowerLimit, upperLimit);
t = 0;
}
var tt = transform.position;
tt.y = Mathf.Lerp(prevHeight, setRandomHeight, t);
transform.position = tt;
}
}
if (dc != null)
{
if (lastRadius != dc.xRadius)
{
moveToRadius = true;
lastRadius = dc.xRadius;
}
}
else
{
if (lastRadius != radius)
{
moveToRadius = true;
lastRadius = radius;
}
}
if (moveToRadius)
{
if (transform.position != radiusPosition)
{
float step = movingToRadiusSpeed * Time.deltaTime;
transform.position = Vector3.MoveTowards(transform.position,
radiusPosition, step);
}
else
{
moveToRadius = false;
}
}
}