- Home /
rotate around character
I'm trying to rotate the camera around the player character but when i use the if statement to see if the left or right arrows (Input name "Fire1") unity tells me that it cant convert an int to a bool. here's the code.
if(Input.("Fire1"))
{
transform.RotateAround(Vector3.forward * Time.deltaTime * 100);
}
Answer by aldonaletto · Jun 15, 2011 at 05:46 PM
You should write:
if (Input.GetButton("Fire1")){
transform.RotateAround(center,Vector3.up,Time.deltaTime*100);
}
Read about this function at:
http://unity3d.com/support/documentation/ScriptReference/Input.GetButton.html
And also about RotateAround in:
http://unity3d.com/support/documentation/ScriptReference/Transform.RotateAround.html
It should be pointed out that center should be the rotation of a transform, meaning the transform you want to be the center of the rotation, in your case I believe the player. If you have a previous declaration pointing to the player you are already half way there. This is also assu$$anonymous$$g this script is on the camera you are trying to rotate.
Answer by Anxo · Jun 15, 2011 at 05:46 PM
Check the documentation for information on how to use Input.
http://unity3d.com/support/documentation/ScriptReference/Input.html
Your answer
Follow this Question
Related Questions
rotate around character 1 Answer
What's the function to replace the obsolete RotateAroundLocal ? 1 Answer
Proper way to rotate an object? 1 Answer
Turning character with transform.Rotate 0 Answers