@@ -864,28 +864,28 @@ function SharedBehaviors.GoToWpt(AI, Owner, Abort)
864
864
865
865
-- test jumping
866
866
local JetAccel = Accel + Vector (- jetStrength , 0 ):RadRotate (Owner .RotAngle + 1.375 * math.pi + Owner :GetAimAngle (false )* 0.25 );
867
- local JumpPos = Owner .Head . Pos + PixelVel + JetAccel * (t * t * 0.5 );
867
+ local JumpPos = ( Owner .Head and Owner . Head . Pos or Owner . Pos ) + PixelVel + JetAccel * (t * t * 0.5 );
868
868
869
869
-- a burst add a one time boost to acceleration
870
870
if Owner .Jetpack :CanTriggerBurst () then
871
871
JumpPos = JumpPos + Vector (- AI .jetBurstFactor , 0 ):AbsRotateTo (JetAccel );
872
872
end
873
873
874
874
-- check for obstacles from the head
875
- Trace = SceneMan :ShortestDistance (Owner .Head . Pos , JumpPos , false );
876
- local jumpScore = SceneMan :CastObstacleRay (Owner .Head . Pos , Trace , JumpPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
875
+ Trace = SceneMan :ShortestDistance (( Owner .Head and Owner . Head . Pos or Owner . Pos ) , JumpPos , false );
876
+ local jumpScore = SceneMan :CastObstacleRay (( Owner .Head and Owner . Head . Pos or Owner . Pos ) , Trace , JumpPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
877
877
if jumpScore < 0 then -- no obstacles: calculate the distance from the future pos to the wpt
878
878
jumpScore = SceneMan :ShortestDistance (Waypoint .Pos , JumpPos , false ).Magnitude ;
879
879
else -- the ray hit terrain or start inside terrain: avoid
880
880
jumpScore = SceneMan :ShortestDistance (Waypoint .Pos , JumpPos , false ).Largest * 2 ;
881
881
end
882
882
883
883
-- test falling
884
- local FallPos = Owner .Head . Pos + PixelVel + Accel * (t * t * 0.5 );
884
+ local FallPos = ( Owner .Head and Owner . Head . Pos or Owner . Pos ) + PixelVel + Accel * (t * t * 0.5 );
885
885
886
886
-- check for obstacles when falling/walking
887
- local Trace = SceneMan :ShortestDistance (Owner .Head . Pos , FallPos , false );
888
- SceneMan :CastObstacleRay (Owner .Head . Pos , Trace , FallPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
887
+ local Trace = SceneMan :ShortestDistance (( Owner .Head and Owner . Head . Pos or Owner . Pos ) , FallPos , false );
888
+ SceneMan :CastObstacleRay (( Owner .Head and Owner . Head . Pos or Owner . Pos ) , Trace , FallPos , Vector (), Owner .ID , Owner .IgnoresWhichTeam , rte .grassID , 3 );
889
889
890
890
if SceneMan :ShortestDistance (Waypoint .Pos , FallPos , false ):MagnitudeIsLessThan (jumpScore ) then
891
891
AI .jump = false ;
0 commit comments