Hello, im new to unity and I’ve tried at least 3 different codes to get my “frog” to move freely on the plane and even used the ( Programmer's Ranch: Unity3D: Moving an Object with Keyboard Input ) Tutorial and nothing helps! All im trying to do is make my box move up, down, left, and right! I would perfer a JavaScript script and not C#… Here is another code im using thats not working,
var frog : Transform;
function Update() {
// we run input GetKeyDown in Update function as the true value will be reset after each frame
// Update is run per each frame
// when player presses up key move the frog forward one unit
// you can increase the units moved by doing this:
// Vector3.forward * 1.5f
if(Input.GetKeyDown(“up”)) {
frog.position = Vector3.forward * 1.5f;
}
if(Input.GetKeyDown(“down”)) {
frog.position = Vector3.back * 1.5f;
}
if(Input.GetKeyDown(“left”)) {
frog.position = Vector3.left * 1.5f;
}
if(Input.GetKeyDown(“right”)) {
frog.position = Vector3.right * 1.5f;
}
}
What happens here is my “frog” Jumps to a certain spot and and wont move… i want my frog to move freely !! Can somebody please help? Thank you!!