I want to stop the movement of 3rd person controller when it enters the dialogue trigger. How can I do this? Thanks in advance
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?
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
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