- Home /
Question by
FatalityGames2 · Aug 10, 2021 at 05:24 AM ·
c#cameracamera-movementcamera rotatecamera-look
How to make my Camera Controller look at target
Hey There, I am currently using a asset for my game in that asset there is a third camera controller. I want that camera controller to look at target without aiming. It could have been simpler if i have used Quaternion.Slerp. but camera script does it other way. It take input axis and calculate what the Camera position and rotation will be. Here that function.
private void calculatePositionAndTarget(float horizontal, float vertical, Vector3 pivot, Vector3 offset, out Vector3 position, out Vector3 target)
{
var rotation = Quaternion.Euler(vertical, horizontal, 0);
var transformPivot = _motorRotation * pivot + _motorPosition;
position = transformPivot + rotation * offset;
target = _motorPosition + pivot + rotation * Vector3.forward * 10;
}
How can I make it look at a target without input?
Comment
Your answer
Follow this Question
Related Questions
Free camera look question 2 Answers
Camera movement similar to World of Guns 0 Answers
Unity Editor Like Camera Script? 1 Answer
How can i make the camera look up and down through keyboard keys? 2 Answers