- Home /
How to move a game object using the mouse
Ideally, id like it so that when I hold down A, the cube moves to the left, and when I hold down D, the cube moves to the right. Ive tried for about an hour now, and this is what I have:
function Start () {
var positionx Input.mousePosition.x;
}
function Update () {
gameObject.transform.position.x(positionx);
}
I get an error telling me that I need a semi colon at the end of var positionx Input.mousePosition.x;, although i already have one... + it just straught up doesnt work
Comment
Your answer
Follow this Question
Related Questions
Move object in front of another 1 Answer
Decrease distance between 2 objects 3 Answers
throw / fling object or prefab 1 Answer