@@ -49,8 +49,8 @@ public static bool Linecast(
49
49
out RaycastHit hitInfo ,
50
50
[ DefaultValue ( "DefaultRaycastLayers" ) ] int layerMask ,
51
51
[ DefaultValue ( "QueryTriggerInteraction.UseGlobal" ) ] QueryTriggerInteraction queryTriggerInteraction ) {
52
- Vector3 direction = end - start ;
53
52
#if UNITY_EDITOR
53
+ var direction = end - start ;
54
54
return RaycastWithHit ( start , direction . normalized , out hitInfo , direction . magnitude , layerMask , queryTriggerInteraction ) ;
55
55
#else
56
56
return Physics . Linecast ( start , end , out hitInfo , layerMask , queryTriggerInteraction ) ;
@@ -60,7 +60,8 @@ public static bool Linecast(
60
60
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
61
61
public static bool Linecast ( Vector3 start , Vector3 end , out RaycastHit hitInfo , int layerMask ) {
62
62
#if UNITY_EDITOR
63
- return RaycastWithHit ( start , end , out hitInfo , layerMask ) ;
63
+ var direction = end - start ;
64
+ return RaycastWithHit ( start , direction . normalized , out hitInfo , direction . magnitude , layerMask ) ;
64
65
#else
65
66
return Physics . Linecast ( start , end , out hitInfo , layerMask ) ;
66
67
#endif
@@ -69,7 +70,8 @@ public static bool Linecast(Vector3 start, Vector3 end, out RaycastHit hitInfo,
69
70
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
70
71
public static bool Linecast ( Vector3 start , Vector3 end , out RaycastHit hitInfo ) {
71
72
#if UNITY_EDITOR
72
- return RaycastWithHit ( start , end , out hitInfo ) ;
73
+ var direction = end - start ;
74
+ return RaycastWithHit ( start , direction . normalized , out hitInfo , direction . magnitude ) ;
73
75
#else
74
76
return Physics . Linecast ( start , end , out hitInfo ) ;
75
77
#endif
0 commit comments