3rd person camera for Roll a Ball
I have this finished Roll a Ball tutorial project, but the case is, that I want the camera to be able to turn around. I have this option to make the character a parent for the camera, but I can't do that because the camera will rotate all around too then. I have a dynamic camera with the script used in the tutorial, which makes the camera follow the character back and forth, but I want it to be able, to follow the object like a SmoothFollow, like a 3rd person. Can someone explain to me how to do that? Maybe give me a sample, or post a script. Thank you
SmoothFollow is not fulfilling your requirements ?
You can also do like you can make a Empty parent then you must make the camera and Ball as child. now you must move the direction of parent ( no rotation ) . It will act the same output as you required
Hierarchy:-
Empty GameObject (Parent)
Ball( child 1)
Camera( child 2 )
Answer by _Yash_ · Dec 22, 2015 at 07:15 AM
Its just a pseudo code and Camera is not child of ball:
// for position
Vector3 targetPos = ball's position - ball's velocity;
targetPos.y = 0f;
taregtPos = Vector3.Normalize(targetPos);
targetPos += offset; // offset is Vector3 for some elevation in Y or to make camera closer or far.
camera's position = targetPos;
// for Rotatation
camera's transform.lookAt( ball's transform );
// you can also add some offset to rotation here to get what you exactly want.
Your answer
![](https://koobas.hobune.stream/wayback/20220612050525im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make the ball follow the cursor? 0 Answers
3rd person rotate around sphere. 0 Answers
Why is my camera rolling around like a ball? 3 Answers
Cinemachine 3rd Camera Zoom 0 Answers