- Home /
stop the movement of 3rd person controller temporarily
I want to stop the movement of 3rd person controller when it enters the dialogue trigger. How can I do this? Thanks in advance
Answer by syedamadiha82 · Oct 05, 2018 at 07:50 AM
Hi, thanks alot. I applied the code above and it works too, but it still has a problem. When I enter the trigger it stops the character's movement but it stops in the same state I entered it (like if I entered the trigger while running into it, the character continues to run but its movement can't be controlled anymore (due to the code). so how do I change my character's state to idle state when its movement stops?
I am facing the same problem , how did you solve it ? Hope you remember the solution even after years :_(
Answer by Baalhug · Sep 28, 2018 at 04:34 PM
The easiest way is:
player.getcomponent<controller>().enabled = false;
where player is the gameobject player and controller is the name of the script 3rd person controller
Answer by Goest_ · Sep 28, 2018 at 04:38 PM
Simply disable the component that is in charge of moving your character
ex.
void OnTriggerEnter(Collider collider)
{
MyController controller = collider.GetComponent<MyController>();
if(controller) //Make sure there is a component to disable
controller.enabled = false;
}
and enable it when dialogue is over
Your answer