- Home /
Focus FPS camera to a target with LookAt
Hello Guys , i very very new to unity just started 1 months back :) but i am addicted to it :D , i am at my first game now. What i am trying to achieve is as follows:-
1) The game is a simple shoot the target. 2) I have a FPS controller 3) I am launching a projectile to hit the center of the screen. 4) I have 3 camera , 1st is the main camera, 2 is the camera which will follow the projectile until it hit the target, and 3rd is the camera which will show the entire target board.
5) Character will not move from the position, but can only look around 360 degrees, to locate the target points.
What i want here is, after i launch the projectile my FPS camera should reset to a position ( empty game object placed at a specific point). So when the Main Camera active again , the user will see the Aim cursor to be reset towards the empty game object. So every time the user is ready to shoot again , he have to aim again.
I used LooAt method but its not worked. What happening is that:
1) After the user shoot, the camera 2 is active , but the user still can move the mouse and so the pointer go to any location. 2) When the Main Camera is active. LookAt turns the main camera towards the empty object, but not exactly looking at the object. 3) If user look upward in the opposite direction, camera just moves to front, but still looking at upward direction. not change the direction to front towards the empty object.
I tried a lots of things but no , luck pardon me for writing a long description , but i guess its needed to explain the scenario :)
Looking forward to hear from you experts very soon :D
Answer by Prabir · Oct 18, 2012 at 06:21 PM
Some updates after i did some head braking on this :) , I have some success:-
1) I am able to stop the mouse movement by disabling the MouseLook script component on both Main camera and FPS character. So this is fine.
2) I try to use LookAt the empty object its seems working. But when i enable the MouseLook script component again. the camera move to some other point , my guess is to the Mouse axis points X and Y.
Any help to stop the override of MouseLook script over the LookAt function.
Answer by Prabir · Oct 18, 2012 at 06:18 PM
Hello Guys if any one is looking for solution, i found it finally in this thread :)
http://answers.unity3d.com/questions/29783/using-mouselook-script-with-lookat-function.html
Best of luck to you guys.
Your answer
Follow this Question
Related Questions
PauseMenu - Camera moves in pausemenu 0 Answers
Rotate smoothly to place? 0 Answers
how to show cursor on specific time? 2 Answers
Camera Rotation 1 Answer
Switching to the player camera 1 Answer