- Home /
When my ball spins, my camera spins to???
Hi, I'm working on a simple ball game So my main character is a ball. I add rigidbody and rigidbody.Addforce script to my ball. It moves and spining perfectly on the ground. But the problem is my camera can't follow the ball. I set parent to my camera, but when the ball spins the camera spins too. Thnx for your help and sorry for my english :)
Answer by Tim-A · Feb 11, 2013 at 01:30 AM
Import the Scripts package from Unity. Assets- Import Package- Scripts. Then add the Smooth Follow Script to the Camera. Then add your ball to the target variable in the Inspector. That should follow the ball wherever it goes.
Answer by Zhendar · Feb 11, 2013 at 03:52 AM
Dude thank you for your help, but it still doesn't work. When I move it right or left, the camera shakes randomly. Actually I have already done something to solve this problem, and I wanna share this with the others brothers. maybe somebody use this :) After the searching thousands scripts and editing them, i wrote a script and here it is! :)
public var a : int = 1; public var b : int = 1; public var c : int = 1;
function Update () {
var player = GameObject.Find("player") ;
var x = player.transform.position.x; var y = player.transform.position.y; var z = player.transform.position.z;
transform.position = Vector3(x+a,y+b,z+c);
}
thank you again bro! :)
If my answer helped you, please tick it correct so others know. :) and Your welcome.
Your answer
![](https://koobas.hobune.stream/wayback/20220613092458im_/https://answers.unity.com/themes/thub/images/avi.jpg)