- Home /
Camera Rotation
Hello Unity3D.I have a question about camera movement.How can i make it that whenever my character hits another character the camera rotates to a 90 degrees on the y-axis so that it looks at my player attacking the opponent?Then when there hasn't been any collision detected in the past 3 seconds the camera rotates back to the original spot before the attack on the other player?If anyone knows how to do this?Can you please tell me how?
Heres what i got so far #pragma strict
var sceneCam : GameObject;
sceneCam = GameObject.Find("MainCam");
var impact : AudioClip;
function OnCollisionEnter (hit : Collision)
{
if(hit.gameObject.name == "Player"){
sceneCam. transform.Rotate(0,90,0);
}
}
Answer by KingMatthew · Nov 13, 2014 at 12:53 AM
I would use an animation for this problem. Make an animation for the camera and have it activate when you collide with the other character/enemy.
Dang i really don't like animating in unity3D.But if it will help then i guess i'll do it
Answer by AngryBurritoCoder · Nov 13, 2014 at 03:49 PM
you can try use http://docs.unity3d.com/ScriptReference/Transform.RotateAround.html (RotateAround)
Your answer
Follow this Question
Related Questions
How to make the FPS camera shake on collision with enemy? 1 Answer
A node in a childnode? 1 Answer
C# Decrease Mouse Sensitivity Camera Move 0 Answers
reset level on collision 3 Answers