I’m trying to make a game where you need to make it through a maze. If you hit an object, you start flying into space, and are forced to reset. I have a script that resets your position, but when I reset the position, I am still flying into space. How can I add some code to my reset script so that the position is reset, AND the flying and spinning is reset (I believe this is the rigidbody)
Here is the reset script
using UnityEngine;
using System.Collections;
public class BasicPlayerReset : MonoBehaviour {
private Vector3 newPos;
void Awake(){
newPos = transform.position;
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
ChangePosition();
}
void ChangePosition(){
Vector3 PlayerSpawn = new Vector3(0f , .9f , 0f);
if(Input.GetKey(KeyCode.V)){
newPos = PlayerSpawn;
transform.position = newPos;
}
}
}
Please format your code correctly by highlighting it all and pushing the button labeled 101/010
– Jeff-Kesselman