- Home /
controls disabled during FPSCamera animation?
I added an animation to a FPSCamera to make it look like the player is being dragged, but during the animation the controls are not working at all. I want to be able to look around, see the enemy pulling you. How do I make it so you can still use the joystick axis's during that animation? (I used legacy animation) and set it to play automatically because its the start of the scene. It then switches to a different camera after the drag scene. And I did use the actual player controller, not just a camera. All the scripts are active for controls.
Answer by ahmedbenlakhdhar · Dec 06, 2014 at 09:34 PM
You may leave the camera animation as it is, and apply the same controls on another game object, then, make your camera a child of this game object.
Wow, that's easy! $$anonymous$$an I need to study more. Thanks sooo much!
Answer by ZegTronic · Dec 06, 2014 at 10:38 PM
i would suggest creating a bool variable to use the joystick, and when the animation starts make it true
for example:(C#)
//Set lookAround to false
private bool lookAround = false;
//When you press the "w" key, do this:
if (Input.GetKey("w")){
//Play the drag animation
animation.Play("Drag");
//You can look around
lookAround = true;
}
and also put it so that in order to look around,
you need the input of the joystick && lookAround == true
for example:(C#)
if (lookAround == true){
float horizontalLook = Input.GetAxis("Mouse X");
transform.Rotate(0, horizontalLook, 0);
}
I formatted your code for you. Please learn how to do this for yourself.
Your answer
Follow this Question
Related Questions
Why isn't Cinemachine switching between cameras? 0 Answers
How to run 1 animation, then other 2 Answers
how make this script follow a target. 1 Answer
How to mirror flip animation curves in Unity? 1 Answer
Good Game by One Person, Is it Possible? 2 Answers