Instant replay??

Hi all, so i’m trying to implement an instant replay in my game, and haven’t found much on the subject. I have a bow and arrow game where you shoot at a target, and then i wanted to replay that action you just did, but view it from a different camera angle. I wasn’t sure if this was something that was so incredibly complicated it wasn’t worth doing, or something possible… thanks :smiley:

incredibly complicated is relative. It’s as simple as storing and restoring the states of the scene objects. There are assets on the store that can help if it’s too complicated or if you want to save development time:. https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=relevance/query=replay

Well you could get the starting point of the arrow like this:

public GameObject arrow;
void Start()
{
    arrow()
}
void arrow()
{
    oArrowX = arrow.position.z;
    oArrowY = arrow.position.y;
}

void OnCollisionEnter(Collision collider)
{
    if(collider.gameObject.CompareTag("target"))
        nArrowX = arrow.position.x;
        nArrowY = arrow.position.y;
        replay()
    else
    //do something e.g. say you missed the target
}

void replay()
{
    //here move the arrow in some way back to the new position started
    //and then destroy it after a second or so using WaitForSeconds(x)
    // x being the number of seconds
}

Whats happening there is you are getting the position of the arrow when it started and when it finished and then you are getting the position of the arrow when it finished and moving from start to finish again. I have left some blank so that you would have to do some yourself as I will not do it all for you

here is a camera follow for arrow

public Transform arrow;

	// Update is called once per frame
	void Update () 
	{
		transform.position = new Vector3 (arrow.position.x + 6, 0, -10 );

	}
}

remember to put it in 2 different files and attach the camera follow to the arrow. When using this camera find out a way to disable the main camera and enable the new arrow camera.
You may want to change the arrow.position.x to arrow.position.y or arrow.position.z depending on which direction you want to show it on.

Hope it helps.

@rodude123