- Home /
Question by
merrycherie · Nov 04, 2011 at 04:44 AM ·
camerajavascriptanimationsrespawnreset
Programming A Reset Scene
I am working on a project that moves the camera through a series of checkpoints. Each checkpoint has a series of instructional animations and I am trying to make it so that as soon as you move forward or backwards from a checkpoint, the scenes all reset themselves to Animation Frame 1. Does anyone have any suggestions? Here's my code -- I know animation.Rewind can reset scenes but not sure how to point Unity to set every object in the game with animation to its starting frame.
private var sceneMoverScript;
private var wayPointScript;
function Awake()
{
wayPointScript = GameObject.Find("Main Camera").GetComponent("waypointMover");
}
function Update ()
{
if(Input.GetMouseButtonDown(0))
{
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100))
{
if(hit.collider.gameObject == gameObject)
{
wayPointScript.moveToPreviousWayPoint();
animation.Rewind;
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How to turn two scripts on/off with a button 1 Answer
Mouse Orbit Reset Camera 0 Answers
Animated camera problems 0 Answers
Setting Scroll View Width GUILayout 1 Answer
Calling Functions from another Script 3 Answers