Hi guys , I tried to write a script that raycasting camera to terrain(name that point x) and player will move this point x.
I am using Orbit camera and i read something that raycasting to terrain with orbit camera is more complex than other camera types. also i am fully locked camera and I wrote code like this and it is worked but When i try to write code on orbit camera it is not worked.
Here is my ray code;
void mouseToWorld(){
RaycastHit hit;
Vector3 mCoo = cam.ScreenToWorldPoint (Input.mousePosition);
mRay = cam.ScreenPointToRay(mCoo);
Debug.DrawRay (mRay.origin, mRay.direction*999, Color.yellow);
}
and here is the Screenshot that shows where ray is casting;
(annotation: when i hit play, ray cast is drawing but when i move the mouse , it doesnt move, it is locked to same position)
Thank you for helps