- Home /
Problem with a ball to roll
Hi , can anybody tell me please a code or in which option i can make ball roll?Because i try codes from top youtube videos, but ball still slide. I make a zigzag clone, but i need ball to roll like this, not to slide. Here this video and another video
P.S. Also i find this code in unity forums. It make ball move, but it still doesnt work:
private Rigidbody rb;
public float speed = 10f;
void Start(){
//if script is attached on your ball
rb = GetComponent<Rigidbody>();
//if not
//rb = GameObject.Find("YourBall's Name").GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce(movement * speed);
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Roll a Ball wont roll? 1 Answer
Making a bubble level (not a game but work tool) 1 Answer
Zombies Rollers Help 0 Answers