I have a capsule 3D GameObject that has a RigidBody assigned to it. It’s Y position is frozen. Adding a script to the capsule with the following code:
using UnityEngine;
using System.Collections;
public class PlayerMovementScript : MonoBehaviour {
Rigidbody rigidBody;
void Start () {
rigidBody = GetComponent<Rigidbody> ();
}
void FixedUpdate () {
rigidBody.AddRelativeForce (Vector3.forward*5f);
}
}
should let the capsule move forward with static speed. However, it doesn’t move at all. Help?