- Home /
Smooth camera follow return
Iim making a catapult game, and when I fire an object the camera follows it. How do I make the camera return to the start once the projectile has been destroyed? Also, how do I make it then follow a new projectile?
Answer by owenpat · Feb 26, 2011 at 05:39 PM
Does the camera start by targetting a stationary bullet (a bullet in Heirarchy was dragged into the Target transform of mainCamera?) If so, it might be easier for the bulletScript to "teleport" the bullet back to the catapult and refreeze itself, instead of destroying it. You'll never need to switch transforms.
If you have the camera aimed at the catapult to begin with, and your code switches to bullets as you spawn them, have the bullet script do the same thing, but in reverse. Something like: GameObject.Find("MainCamera").GetComponenent("SmoothFollow").Target = GameObject.Find("catapult").transform;
Either way, you can also do something in smoothFollow
like:
if (target is moving) put camera behind it aiming the way it moves
else put camera over it
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Setting Scroll View Width GUILayout 1 Answer
Another camera drag script, can anyone figure out these errors? 1 Answer
Camera not through terrain 3 Answers
Pan Orthographic Camera? 2 Answers