Pathfinding.RVO.RVOController.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
		public void Update () {
			if (lastPosition != tr.position) {
				Teleport (tr.position);
			}
			
			if (lockWhenNotMoving) {
				locked = desiredVelocity == Vector3.zero;
			}
			
			UpdateAgentProperties ();
			
			RaycastHit hit;
			
			//The non-interpolated position
			Vector3 realPos = rvoAgent.InterpolatedPosition;
			realPos.y = adjustedY;
			
			if (mask != 0 && Physics.Raycast (realPos + Vector3.up*height*0.5f,Vector3.down, out hit, float.PositiveInfinity, mask)) {
				adjustedY = hit.point.y;
			} else {
				adjustedY = 0;
			}
			realPos.y = adjustedY;
			
			rvoAgent.Position = new Vector3(rvoAgent.Position.x, adjustedY, rvoAgent.Position.z);
			
			Vector3 force = Vector3.zero;
			
			if (wallAvoidFalloff > 0 && wallAvoidForce > 0) {
				List<ObstacleVertex> obst = rvoAgent.NeighbourObstacles;
	
				for (int i=0;i<obst.Count;i++) {
					Vector3 a = obst[i].position;
					Vector3 b = obst[i].next.position;
	
					Vector3 closest = position - AstarMath.NearestPointStrict (a,b,position);
					
					if (closest == a || closest == b) continue;
					
					float dist = closest.sqrMagnitude;
					closest /= dist*wallAvoidFalloff;
					force += closest;
				}
			}
			
	#if ASTARDEBUG
			Debug.DrawRay (position, desiredVelocity + force*wallAvoidForce);
	#endif
			rvoAgent.DesiredVelocity = desiredVelocity + force*wallAvoidForce; 
	
			tr.position = realPos + Vector3.up*height*0.5f - center;
			lastPosition = tr.position;
		}