Search Unity

Question Probuilder PickFace return second hit?

Discussion in 'Editor & General Support' started by tree_arb, Feb 8, 2023.

  1. tree_arb

    tree_arb

    Joined:
    Dec 30, 2019
    Posts:
    323
    Im working with this probuilder demo scene:

    Code (CSharp):
    1. [B]runtime MeshEditorScene[/B]
    2.  
    3. using ProBuilder.Examples;
    4.  
    5. public class MeshEditor : MonoBehaviour
    6. {
    7. ...
    This probuilder demo scene uses the PickFace method to mouse select a face, and allow pulling/extruding the faces of a cube to resize a cube mesh.


    PickFace(Camera, Vector3, ProBuilderMesh)
    Returns the first hit face on a ProBuilder mesh given a screen position and camera.


    How might I return the second hit, or select the "back faces" of a cube?

    I follow this method down to SelectionPicker.PickFace where it is then hidden by dll.

    I cannot simply reverse the ray and send it in, because it takes a camera as the parameter and presumably does the ray casing in the dll

    The only way I came up with was to mouse click, put a temp camera at the end of the ray looking backwards to hit the back wall of the cube, and feed in that camera. (works but has some issues)

    (ultimate goal would be to click faces and maybe shift+click to select back walls...or, maybe just a smaller hit target on each face like unity box collider editor).

    The cubes are transparent faces if that helps explain the goal. I can see both front and back faces but cannot select back faces without hitting the front faces first

    see pic