- Home /
How do I rotate my Ball Character with the direction the Camera is looking at.
So I basically have a pink ball as an object which has a camera in it. So when I start the game the camera of floats above the character and is able to rotate just like I wanted it. But my problem is that I want the player character to rotate with the camera. Right now I am only able to rotate the camera and change directions of where the player is going, but the face of the ball is not following the camera. The face is just standing still even when I move the Camera. Does anyone know how to align the Ball with the camera?
unless you share some insights of the objects relation to each other and what script is moving things and where it is located in relation to the objects - no.
Please add more info.
Answer by ThatsNotMeNo · Dec 07, 2021 at 05:04 PM
Alright so im using this script for the camera. using UnityEngine; public class MoveCamera : MonoBehaviour { public Transform player; void Update() { transform.position = player.transform.position; } }
now i want the ball direction to follow the camera with a clamp. @Captain_Pineapple
Answer by Captain_Pineapple · Dec 07, 2021 at 05:44 PM
In that case i'd suggest the following: Instead of rotating the camera, rotate the player. Make the camera a child of the player and set it in a distance where you want the camera to be. This way your camera will always rotate with your player and keep a fixed distance while always showing your player in the middle.
I suggest you stick with this solution until you have a better understanding of unityrelated programming. Then you can come back to this issue and rework it.
Other then that this is a problem that has been done by a million people already so there is no shame in using a premade script for camera controls. Unless it is for the purpose of learning how to do it there is no real sense in reinventing the wheel unless you have really specific requirements for your project.