RacastHit return always -Vector3 up

Hi,
I have a gameObject with a script, and camera that can move in two ways.
-Rotate around an object
-Horizzontal and Vertical
With mouse you can select the move.

But when the 2nd kind of movement it end, i need to assign another point to see for rotate around it.
When the button is up call the script below.
But hit.transform.position is always 0,-1,0
I paid attention to hit a big cube that now use as test terrain.
Thx for help ^^

        Camera camera = this.GetComponent<Camera>();
        Vector3 vector = Vector3.zero;
        if (Physics.Raycast(this.transform.position,this.transform.forward, out RaycastHit hit, 100))
            vector = hit.transform.position;
        return vector;

hit.transform.position returns position of the transform, maybe you wanted hit.position ?

1 Like

Yeah, i tryed to use hit.collider.tranform.position but always the same story :frowning:

EDIT:

I’m novice XD
I need write a simple hit.point :smile:
Thx