public Vector3d Project(Vector3d vPoint, int identifier = -1) { SORayHit nearest; Target.FindNearest(vPoint, double.MaxValue, out nearest, eInCoords); return(nearest.hitPos + Offset * nearest.hitNormal); }
public static bool FindNearestPoint(IEnumerable <SceneObject> vSceneObjects, Vector3d point, double maxDist, out SORayHit nearest, CoordSpace eSpace = CoordSpace.WorldCoords) { nearest = null; foreach (var so in vSceneObjects) { if (so is SpatialQueryableSO) { SpatialQueryableSO spatialSO = so as SpatialQueryableSO; if (spatialSO.SupportsNearestQuery) { SORayHit soNearest; if (spatialSO.FindNearest(point, maxDist, out soNearest, eSpace)) { if (nearest == null || soNearest.fHitDist < nearest.fHitDist) { nearest = soNearest; } } } } } return(nearest != null); }