Strange hit.point behavior. Transform location zooms toward camera. Look at the code

ok so this code almost works. attach this code to your main camera. make a sphere. put that sphere in this scripts transform slot.

make a plane extending forever.

press play.

notice how the sphere goes where its supposed to (aka the hit.point of the ray) and then zooms towards the camera.

odd.

var aimTarget: Transform;
var hit : RaycastHit;
var point : Vector3;

function Update () {
var ray: Ray = Camera.main.ScreenPointToRay(Input.mousePosition);

	if (Physics.Raycast(ray, hit)) {
		aimTarget.position = hit.point;
		print(hit.point);
	}
}

If the aimTarget has a collider on it, that too is being raycasted. I’ve had this problem before.

lol wow i feel stupid. i just realised it 3 seconds ago and yea, came back to see that you already got to it.

so yeah, be sure to turn off the collider … lol