- Home /
stop player movenment
hi guys i have encounter this very big problem. i found this script in forum under http://answers.unity3d.com/questions/17810/how-to-stop-a-script-for-a-while.html
function OnTriggerEnter (collision : Collider) {
if (collision.gameObject.tag == "Player") { GameObject.Find("Player").GetComponent("ThirdPersonController").enabled=false; print("HELLO"); } }
i creating a cube object and when the player hit the object the player suppose to stop moving for a few seconds,the collider is working but the third person controller script is not disable. i try access to the thirdpersoncontroller but it still not working.should i put enabled to the thirdpersoncontroller but how ? the third person controller i using is from the lerpz tutorial.thank you so much if some one could help me.
Answer by Nonakesh · Sep 08, 2011 at 06:02 PM
I think your problem is that the OnTriggerEnter function only works when one of the object has a rigidbody attached. (I don't think that the third-person-controller uses a rigidbody)
You can read more here: http://unity3d.com/support/documentation/ScriptReference/Collider.OnTriggerEnter.html
I haven't found any way to use colliders without rigidbody, but you can try to make a dummy rigidbody that is controlled by the character-controller!