Question by
DragonFire011 · Apr 11, 2016 at 08:06 AM ·
cameravector3resetreset-positionreset-state
Camera Reset Script
Hey everyone, I was wondering on how to make a camera go back to its original position when you click a button (script will be stored on the button).
I tried using vector3 but I just couldn't get it to work with the button, any ideas?
Comment
Answer by Redwolve · Apr 12, 2016 at 03:51 AM
Top of my head answer would be to store the original position and rotation and assign them when button is clicked var startPos:GameObject; var startRot:GameObject;
Start(){
startPos.transform.position=gameObject.transform.position startRot.transform.rotation=gameObject.transform.rotation
}
function Reset(){
gameObject.transform.position=startPos;
gameObject.transform.rotation=startRot;
}
Should work something like that, I default to JS so if you need it in C# it should take very much to figure out. Let me know if it helps!