How to Position Correctly from Mouse Click

The problem I’m having is when I create objects based on mouse position, they work until I lower them, then a slight left or right, doesn’t have the desired effect on the ground where it should be much greater.

Such as if I click and create at the camera then a mouse moment left or right is fine, but when I create on the ground there only .0 meters apart where they should be like 5m apart.

Any ideas?

Still no luck :frowning:

If you’re trying to make it so when you left click it creates something where the mouse is…

Game_Mouse1 is a gamespace dummy object, it has no visual representation.
Screen_Mouse1 is a UI element that the player sees.

function UpdateScreenMouse(){
    var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
    var hit : RaycastHit;
    var tx : float = 0.0;
    var ty : float = 0.0;
    if (Physics.Raycast (ray, hit, 1000)) {
            
            //hit.point   is where terrain is. 
            Game_Mouse1.transform.position = hit.point; 
            tx = Screen_Mouse1.guiTexture.pixelInset.width;
            ty = Screen_Mouse1.guiTexture.pixelInset.height;
            Screen_Mouse1.guiTexture.pixelInset = Rect(Camera.main.WorldToScreenPoint(hit.point).x - tx/2, Camera.main.WorldToScreenPoint(hit.point).y - ty/2,tx,ty);
    }
}