Hi everyboby,
i got a gui crosshair in the middle of the screen and i have hide/locked the mouse cursor using
Screen.lockCursor = true; ( has i am in webplayer the cursor is automaticly hide )
My camera is an third person view with orbitScript.
i have a cyllinder in front of my caracter and i put this script in cyllinder
public bool testEloignement(){
if( target.transform.position.x < transform.position.x + 2 && target.transform.position.x > transform.position.x - 2){
if(target.transform.position.z < transform.position.z + 2 && target.transform.position.z > transform.position.z - 2){
return true;
}else
return false;
}else
return false;}
and
void OnMouseOver(){
if(Input.GetMouseButtonDown(0) && testEloignement()){
Debug.Log("clic");
}
Debug.Log("over");
}
But this works only if my cyllinder is between my caracter and the center of the screen.
I have try also to use raycast but maybe not in good way. Cause it do the same a OnMouseOver()
how can i do to clic on it in the frontside ?`