Hello, I don’t know if this question has been asked before, I haven’t found it.
Im creating a hook.
Im getting the 3d mouse position using a raycast, then using a raycast from the player position to the 3d mouse position.
for some reason the second raycast only registers a hit in one side of the box collider.
no errors.
Using Unity 2020.2.6
the code:
//some code
RaycastHit mouseHit;
RaycastHit hit;
var mouseRay = main.ScreenPointToRay(Input.mousePosition);
var mouseRaycast = Physics.Raycast(mouseRay, out mouseHit, 999f, mask);
var objectRaycast = Physics.Raycast(transform.position, mouseHit.point, out hit, maxDistanceRaycast, mask);
if (mouseRaycast && objectRaycast){
// Does something
}
Thank you for reading this.
- David