Hello everyone
I am having an issue with a ball that I roll around using the AddForce() function. When the health of the ball reaches 0, I want that ball’s position to reset to the position at which it was when the level loaded up. Here is the code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
private int health = 4;
private Vector3 originalPosition;
void Start () {
originalPosition = rigidbody.transform.position;
}
void Update () {
if (health <= 0)
{
Die();
}
}
void Die () {
rigidbody.transform.position = originalPosition;
}
However, after the ball’s position is reset, it stays in place and I can no longer move it using AddForce();