- Home /
Dragging gameobjects always at the center of the mouse?
when i drag the object it follows the mouse point but its not exactly in the middle of the mouse. how can i make it so that the object is in the middle of the mouse in any point of the screen?
point = Camera.main.ScreenToWorldPoint(newVector3(Input.mousePosition.x,Input.mousePosition.y,30.0f));
Is it possible that the gameobject's pivot point is not exactly at it's center? If you set the transform.position of an object, it uses the pivot point as the point that has to conform to the new position.
im not sure. but how can i change the pivot point of an object?
This is only possible in a 3d modelling application.
You can check, however, by just selecting the gameobject in question, and looking at it with the scene camera from straight above.
It would be nice if you could attach a couple of pictures of the issue. However I'm going to guess that the issue is that the object appears to be trailing behind the mouse because the mouse's position (from the OS) is being updated more frequently than the objects position (as an object in an application). In this case you should hide the operating system mouse icon and ins$$anonymous$$d display a mouse icon in the game which is update similarly to your gameObject.
Your answer
![](https://koobas.hobune.stream/wayback/20220613200957im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
3d Object attach to mouse 1 Answer
Checking if mouse dragged from one point to another 2 Answers
Is There An OnMouseStop? 0 Answers
Convert Mouse Position - To Transform 1 Answer
How can my mouse-controlled object interact with Rigidbodies? 0 Answers