@@ -468,9 +468,8 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
468468 AI .deviceState = AHuman .DIGGING ;
469469 obstacleState = Actor .DIGPAUSING ;
470470 nextLatMove = Actor .LAT_STILL ;
471- sweepRange = math.min (math.pi * 0.2 , Owner .AimRange );
471+ sweepRange = math.min (math.pi * 0.25 , Owner .AimRange );
472472 StuckTimer :SetSimTimeLimitMS (6000 );
473- AI .Ctrl .AnalogAim = SceneMan :ShortestDistance (Owner .Pos , Waypoint .Pos , false ).Normalized ; -- aim in the direction of the next waypoint
474473 else
475474 digState = AHuman .NOTDIGGING ;
476475 obstacleState = Actor .PROCEEDING ;
@@ -705,7 +704,7 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
705704 obstacleState = Actor .DIGPAUSING ; -- tunnel cavity not clear yet, so stay put and dig some more
706705 end
707706
708- local aimAngle = Owner :GetAimAngle (true );
707+ local aimAngle = Owner :GetAimAngle (false );
709708 local AimVec = Vector (1 , 0 ):RadRotate (aimAngle );
710709
711710 local angDiff = math.asin (AimVec :Cross (CurrDist .Normalized )); -- the angle between CurrDist and AimVec
@@ -725,11 +724,14 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
725724
726725 angDiff = math.asin (AimVec :Cross (DigTarget .Normalized )); -- The angle between DigTarget and AimVec
727726 if math.abs (angDiff ) < 0.1 then
728- sweepCW = not sweepCW ; -- this is close enough, go in the other direction next frame
729- else
730- AI .Ctrl .AnalogAim = (Vector (AimVec .X , AimVec .Y ):RadRotate (- angDiff * 0.15 )).Normalized ;
727+ AI .Ctrl .AnalogAim = DigTarget .Normalized ; -- aim in the direction of the next waypoint
728+ sweepCW = not sweepCW ;
731729 end
732730
731+ local sweepSpeed = 2.5 ;
732+ local sweepDir = sweepCW and 1 or - 1 ;
733+ AI .Ctrl .AnalogAim = (Vector (AimVec .X , AimVec .Y ):RadRotate (sweepDir * TimerMan .AIDeltaTimeSecs * sweepSpeed )).Normalized ;
734+
733735 -- check if we are done when we get close enough to the waypoint
734736 if Owner .AIMode == Actor .AIMODE_GOLDDIG then
735737 Waypoint .Pos = SceneMan :MovePointToGround (Waypoint .Pos , Owner .Height * 0.2 , 4 );
0 commit comments