I’m currently using Rigidbody to move a capsule. I want to move it up, but for some reason it only goes down. Any ideas?
public class generater : MonoBehaviour {
public float speed;
public GameObject[] generateObjects;
public float timeDelay = 5;
//private int randValue;
//private float getTimer;
private GameObject currentObj;
private Vector3 objStart;
private Vector3 currentObjPos;
// Use this for initialization
void Start () {
//getTimer = GameObject.FindGameObjectWithTag("Player").GetComponent<life_time>().max_time;
objStart = new Vector3 (0.5f, -3.8f, 0f);
InvokeRepeating ("createObj", timeDelay, timeDelay);
}
void createObj()
{
currentObj = Instantiate(generateObjects[0]) as GameObject;
currentObj.transform.position = objStart;
}
void Update()
{
if(GameObject.FindGameObjectWithTag("enemy"))
{
currentObj.transform.rigidbody.AddForce(0f, 0f, speed);
}
}
Also I have frozen all over axis except for the y position in RigidBody.