@@ -100,7 +100,7 @@ public int Write(WriteAdapter adapter)
100
100
{
101
101
PerceiveStatic (
102
102
m_RayDistance , m_Angles , m_DetectableObjects , m_StartOffset , m_EndOffset ,
103
- m_CastRadius , m_Transform , m_CastType , m_Observations , false , m_LayerMask ,
103
+ m_CastRadius , m_Transform , m_CastType , m_Observations , m_LayerMask ,
104
104
m_DebugDisplayInfo
105
105
) ;
106
106
adapter . AddRange ( m_Observations ) ;
@@ -144,10 +144,6 @@ public virtual SensorCompressionType GetCompressionType()
144
144
/// 3. The 'length+1' element of the sublist will contain the normalised distance to the object hit, or 1 if
145
145
/// nothing was hit.
146
146
///
147
- /// The legacyHitFractionBehavior changes the behavior to be backwards compatible but has some
148
- /// counter-intuitive behavior:
149
- /// * if the cast hits a object that's not in the detectableObjects list, all results are 0
150
- /// * if the cast doesn't hit, the hit fraction field is 0
151
147
/// </summary>
152
148
/// <param name="rayLength"></param>
153
149
/// <param name="rayAngles">List of angles (in degrees) used to define the rays. 90 degrees is considered
@@ -160,14 +156,12 @@ public virtual SensorCompressionType GetCompressionType()
160
156
/// <param name="transform">Transform of the GameObject</param>
161
157
/// <param name="castType">Whether to perform the casts in 2D or 3D.</param>
162
158
/// <param name="perceptionBuffer">Output array of floats. Must be (num rays) * (num tags + 2) in size.</param>
163
- /// <param name="legacyHitFractionBehavior">Whether to use the legacy behavior for hit fractions.</param>
164
159
/// <param name="debugInfo">Optional debug information output, only used by RayPerceptionSensor.</param>
165
160
///
166
161
public static void PerceiveStatic ( float rayLength ,
167
162
IReadOnlyList < float > rayAngles , IReadOnlyList < string > detectableObjects ,
168
163
float startOffset , float endOffset , float castRadius ,
169
164
Transform transform , CastType castType , float [ ] perceptionBuffer ,
170
- bool legacyHitFractionBehavior = false ,
171
165
int layerMask = Physics . DefaultRaycastLayers ,
172
166
DebugDisplayInfo debugInfo = null )
173
167
{
@@ -212,10 +206,6 @@ public static void PerceiveStatic(float rayLength,
212
206
// sublist[numObjects-1] <- did hit detectableObjects[numObjects-1]
213
207
// sublist[numObjects ] <- 1 if missed else 0
214
208
// sublist[numObjects+1] <- hit fraction (or 1 if no hit)
215
- // The legacyHitFractionBehavior changes the behavior to be backwards compatible but has some
216
- // counter-intuitive behavior:
217
- // * if the cast hits a object that's not in the detectableObjects list, all results are 0
218
- // * if the cast doesn't hit, the hit fraction field is 0
219
209
220
210
bool castHit ;
221
211
float hitFraction ;
@@ -285,7 +275,7 @@ public static void PerceiveStatic(float rayLength,
285
275
}
286
276
}
287
277
288
- if ( ! hitTaggedObject && ! legacyHitFractionBehavior )
278
+ if ( ! hitTaggedObject )
289
279
{
290
280
// Something was hit but not on the list. Still set the hit fraction.
291
281
perceptionBuffer [ bufferOffset + detectableObjects . Count + 1 ] = hitFraction ;
@@ -294,11 +284,8 @@ public static void PerceiveStatic(float rayLength,
294
284
else
295
285
{
296
286
perceptionBuffer [ bufferOffset + detectableObjects . Count ] = 1f ;
297
- if ( ! legacyHitFractionBehavior )
298
- {
299
- // Nothing was hit, so there's full clearance in front of the agent.
300
- perceptionBuffer [ bufferOffset + detectableObjects . Count + 1 ] = 1.0f ;
301
- }
287
+ // Nothing was hit, so there's full clearance in front of the agent.
288
+ perceptionBuffer [ bufferOffset + detectableObjects . Count + 1 ] = 1.0f ;
302
289
}
303
290
304
291
bufferOffset += detectableObjects . Count + 2 ;
0 commit comments