Hey.
I am having trouble with scripting gameobject (cube).
I would like that cube would follow mouse cursor on X and Y axes.
I have done some scripting, everything works fine, except cube is following cursor at very slow speed.
- I would like that cube would be more responding on what i do with my mouse.
- I would like that cube would follow cursor at the same speed that cursor moves.
My script:
function Update () {
var halfW:float = Screen.width/2;
transform.position.x = (Input.mousePosition.x - halfW)/halfW;
var halfH:float = Screen.height/2;
transform.position.y = (Input.mousePosition.y - halfH)/halfH;
}
Second problem i have is:
- when i hit Sphere(ball) with Cube with little more power, ball falls through Cube.
Video presentation of those two problems: http://screencast.com/t/qK1acA87F
If someone know how to solve those two, or at least one problem, pleas help !
I will own you one.
Anze