- Home /
Question by
johnmcmonigle · Jan 29, 2018 at 02:18 PM ·
c#scripting problemnot workingroll a ballrolling
Roll a Ball wont roll?
Hey guys - I have been trying any answer I could find, but I just can't seem to get my ball rolling. My speed is set to 100, and i've got the following script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
private Rigidbody rb;
public float speed;
void Start (){
rb = 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);
}
}
If anyone could help me out, that'd be fantastic.
,
Comment
Best Answer
Answer by dev-waqas · Jan 29, 2018 at 02:25 PM
You should change fixedUpdate()
to FixedUpdate()
.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Problem with a ball to roll 0 Answers
Problem changing string value. 2 Answers