- Home /
Clunky Mouse Follow
I'm making a script so that you can place items in a level. Currently, I have the following script:
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100)) {
Debug.DrawLine (ray.origin, hit.point);
movingObject.transform.position = Vector3(hit.point.x,hit.point.y,0);
}
Now, this works almost perfectly, but it is very clunky. By that I mean the object shakes all over the place and does not move smoothly, especially when moving the mouse down. Is there a better way I could be doing this?
Answer by xKroniK13x · Jul 06, 2012 at 04:39 PM
It was because there was a collider on the object. Simple fix.
Your answer
Follow this Question
Related Questions
Move the player towards the cube to attack. 0 Answers
I am trying to allow the player to pick up and move objects in a FPS style game 0 Answers
Detect a click outside a GUI/object 4 Answers
Moving object with mouse on release 0 Answers
Moving a object around with mouse, rotating it with arrow keys and placing it. 1 Answer