@@ -468,9 +468,8 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
468
468
AI .deviceState = AHuman .DIGGING ;
469
469
obstacleState = Actor .DIGPAUSING ;
470
470
nextLatMove = Actor .LAT_STILL ;
471
- sweepRange = math.min (math.pi * 0.2 , Owner .AimRange );
471
+ sweepRange = math.min (math.pi * 0.25 , Owner .AimRange );
472
472
StuckTimer :SetSimTimeLimitMS (6000 );
473
- AI .Ctrl .AnalogAim = SceneMan :ShortestDistance (Owner .Pos , Waypoint .Pos , false ).Normalized ; -- aim in the direction of the next waypoint
474
473
else
475
474
digState = AHuman .NOTDIGGING ;
476
475
obstacleState = Actor .PROCEEDING ;
@@ -705,7 +704,7 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
705
704
obstacleState = Actor .DIGPAUSING ; -- tunnel cavity not clear yet, so stay put and dig some more
706
705
end
707
706
708
- local aimAngle = Owner :GetAimAngle (true );
707
+ local aimAngle = Owner :GetAimAngle (false );
709
708
local AimVec = Vector (1 , 0 ):RadRotate (aimAngle );
710
709
711
710
local angDiff = math.asin (AimVec :Cross (CurrDist .Normalized )); -- the angle between CurrDist and AimVec
@@ -725,11 +724,14 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
725
724
726
725
angDiff = math.asin (AimVec :Cross (DigTarget .Normalized )); -- The angle between DigTarget and AimVec
727
726
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 ;
731
729
end
732
730
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
+
733
735
-- check if we are done when we get close enough to the waypoint
734
736
if Owner .AIMode == Actor .AIMODE_GOLDDIG then
735
737
Waypoint .Pos = SceneMan :MovePointToGround (Waypoint .Pos , Owner .Height * 0.2 , 4 );
0 commit comments