fixed orientation

fixed orientation and return distance to mesh