216 {
217 vector corners[4];
219
220
221 vector avgPosition = vector.Zero;
222 for (int i = 0; i < 4; i++)
223 {
224 avgPosition = avgPosition + corners[i];
225 }
226
227 avgPosition = avgPosition * 0.25;
228
229
231
232 vector normal = vector.Up;
233 vector dirUp = GetDirectionUp();
234
235 bool testLand = depth < -1.0;
236
237
238 if (testLand)
239 {
240
242
243
245
246
248
249
251
252 for (i = 0; i < 4; i++)
253 {
255
257
259 }
260
261 vector d0 = vector.Direction(corners[0], corners[1]);
262 vector d1 = vector.Direction(corners[0], corners[2]);
263
266
267
268 normal = d0 * d1;
269 }
270
271 bool isFlipped = vector.Dot(normal, dirUp) < Math.Cos(angleTolerance * Math.DEG2RAD);
272
273#ifdef DIAG_DEVELOPER
274 if (ctx.IsDebug())
275 {
276 int color = 0xFF00FF00;
277 if (isFlipped)
278 color = 0xFFFF0000;
279
284 }
285#endif
286
287 return isFlipped;
288 }
proto native float GetWaterDepth(vector posWS)
proto native bool GetSurface(SurfaceDetectionParameters params, SurfaceDetectionResult result)
API for surface detection.
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
Object ignore
Object to ignore tracing against, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
float height
Height position.
ref SurfaceDetectionParameters m_SurfaceParams
ref SurfaceDetectionResult m_SurfaceResult
proto float Normalize()
Normalizes vector. Returns length.
proto native CGame GetGame()