- Home /
Space Game Camera
Hi everyone.
I try to make the smooth follow camera rotate with my spaceship. when i press "e" or "q" my ship rotates around the x axis when you look from behind to the ship. But the Camera didnt rotate. I used the normal smoothfollow script but cause i am very new i understand nearly nothing from it. Hope someone can help. Sry for my english.
Thanks Averlion
Answer by Pirate___man · Jun 21, 2010 at 06:23 PM
I don't get your question very well but i'll try to answer it.
Here is another smooth follow script specifically designed for spaceship games (Javascript):
var target : Transform; var distance = 3.0; var height = 3.0; var damping = 5.0; var smoothRotation = true; var rotationDamping = 10.0;
function Update () { var wantedPosition = target.TransformPoint(0, height, -distance); transform.position = Vector3.Lerp (transform.position, wantedPosition, Time.deltaTime * damping);
if (smoothRotation) {
var wantedRotation = Quaternion.LookRotation(target.position - transform.position, target.up);
transform.rotation = Quaternion.Slerp (transform.rotation, wantedRotation, Time.deltaTime * rotationDamping);
}
else transform.LookAt (target, target.up);
}
But if you trying to make the camera just follow and rotate you could just move the camera to the location you want and then make it the child of the mesh. Hopefully that helps!!!!
Answer by smoketh · Sep 15, 2012 at 12:42 AM
Its jiggling as hell. Here take a look. http://beast-rage-games.tk/WebPlayer/WebPlayer.html Controls - arrows + xc for roll, a/z - increase/decrease speed, f - afterburner.
It was also jiggling for me. I fixed it by modifying my movement script. Just added "Time.deltaTime" and increased my movement speed.
Your answer
![](https://koobas.hobune.stream/wayback/20220613062640im_/https://answers.unity.com/themes/thub/images/avi.jpg)