Hello,
I used this code for making my object follow the mouse (2d):
var followingObject : Transform;
var xPos: float;
var yPos: float;
function Update () {
xPos=Input.mousePosition.x;
yPos=Input.mousePosition.y;
followingObject.position = Vector2(xPos,yPos);
}
it seems doesn’t work good its like not on the mouse by alot of diffrence, cause the mouse starts from the down left of screen and the object from the center, so how to make perfectly on the mouse? i used raycast but i didnt like it cause it was not working good like the object run off the mouse
thanks.