- Home /
Object doen't move even though i did according lesson
Hello, i am beginner so i start studying lessons so i tried to create roll-a-ball game i did everything according video tutorial but i got problem in 3rd part of video its about moving Player(ball) i write code exactly like in video but i can't move my ball and code has no error or bug.
Thanks for attention :)
have you attached the scripts to the correct game objects in the scene? Also why haven't you linked your code or the tutorial video? You are asking us to assume you DID everything the video told you to, please explain step by step what you've done including any script association with objects.
http://unity3d.com/learn/tutorials/projects/roll-a-ball/moving-the-player This is video tutorial.
THis is code: using UnityEngine; using System.Collections;
public class playercontroler : $$anonymous$$onoBehaviour { public float speed; void Fixedupdate () { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
}
And this is how i did my progress: 1) First create project and scene 2) Then create Plane(and reset it on origin location) 3) then create ball(and reset it on origin location) 4) then create lights( and reset it on origin location) 5) then make ball rigidbody. 6) create script which is attacked on ball. 7) when i finished script code i run game, no bug, no error, but ball is not moving.
Thanks
Are you pressing the right key for your "Horizontal Axis" when you play your game. You can check in : Edit > Project Settings > Input. This will show you which buttons are assigned to the axes.
You also have to assign a value to the speed variable in the inspector of the ball.
Answer by Daduna · Oct 22, 2014 at 03:26 PM
Thank you guys ball is moving at last :) needed input change and speed raise :)
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Getting Started Tutorials? 1 Answer
Are there any in depth beginner tutorials? 6 Answers
"Object reference not set to an instance of an object" (Super simple) 1 Answer
Player shoot up in the air HELP 1 Answer