Search Unity

Removing Layer from PhysicsRaycaster.eventMask causes pointerCurrentRaycast to become invalid

Discussion in 'UGUI & TextMesh Pro' started by Deleted User, Dec 1, 2015.

  1. Deleted User

    Deleted User

    Guest

    Let me explain my usecase.

    I have a cube on a flat plane. My cube's Layer is "Interactable" and my flat plane's layer is "Floor". PhysicsRaycaster is on my camera.

    When I begin an OnDrag operation on my cube, I tell my PhysicsRaycaster's eventMask to only pay attention to the Floor layer. This continues until OnDragEnd, when I reset PhysicsRaycaster's eventMask back to its original settings. If I do not do this, pointerCurrentRaycast would (in addition to the Floor layer) return the worldSpace coordinates coming from the Interactable object I am dragging itself.

    The idea here is two fold.

    1. To make it so PointerEventData's pointerCurrentRaycast.worldSpace return value is returning the collision point with my flat plane (on the Floor layer).
    2. Make it so my rays shoot right through my Interactable object and hit the Floor (so as to not have my object occluding my goal, which is keeping the object directly on the floor)

    I believe this used to work but broke whenever pointerCurrentRaycast.worldSpace was first introduced. It used to be that worldSpace existed as a variable of PointerEventData.

    Is this a bug I should report?
     
  2. Deleted User

    Deleted User

    Guest

    Nevermind, this is false. I had my layers screwed up on my floor. :(

    I do still think that pointerCurrentRaycast.worldPosition seems to act a lot different than the worldPosition that used to live inside of PointerEventData, but I'm not entirely sure all of the ways how...
     
    Last edited by a moderator: Dec 2, 2015