- Home /
Question by
pastersteli · May 13 at 01:28 PM ·
physicsraycastbuildscreenpointtoray
Raycast not working on build
Everything works properly in editor but when trying on a android phone, raycast not working properly. If statement is not being true. there is collider.Mouse position is correct. onpointermove works. query hit triggers enabled.I have tried with disabling stripping.
public void OnPointerMove(PointerEventData eventData)
{
RaycastHit hit;
int layerMask = LayerMask.GetMask("Default");
if (Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit, 100f, layerMask, QueryTriggerInteraction.Collide))
{
text.text = "move";
int cordX = (int)(hit.textureCoord.x * texture.width);
int cordY = (int)(hit.textureCoord.y * texture.height);
ColorSelector.singleton.ChangeColor(texture.GetPixel(cordX, cordY));
}
}
Comment
Your answer
Follow this Question
Related Questions
Is there a limit on the distance of raycast? 2 Answers
Distribute terrain in zones 3 Answers
Editor vs Build: OnTriggerStay & Physics Issues 0 Answers
Physics.SphereCastAll with triggers 1 Answer