Before updating to Windows 10 you may need to return your Pro license. More information here

Simple trigger question

I have a quiz type game in which you walk up to a door, get asked a question, and if you get the question right the door gets destroyed and you move on. If not it locks and you have to find a way around. Currently everything works fine with the exception then when your picking your answer the mouselook is spinning your character around. I've gotten it so I disable the mouseLook script on entering the trigger but if the person gets the question right and the wall gets destroyed, onTriggerExit never gets called to turn the mouseLook script back on. Any ideas?

more ▼

asked Aug 31, 2010 at 05:40 PM

avatar image

Will 11
13 3 2 8

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

First, make sure you are using the correct OnTriggerExit() syntax:

function OnTriggerExit(other : Collider)
    // Disable MouseLook script

If you are, then why don't you try re-enabling the MouseLook script in the same function where you destroy the wall? That would seem more logical, unless you use OnTriggerExit() for other purposes in your game.

more ▼

answered Aug 31, 2010 at 06:12 PM

avatar image

887 19 20 39

I'm still trying to learn how to change a variable on one gameObject script with a script from a different gameObject. IE: Disabling mouselook on the FPS controller with a script attached to the trigger. Perhaps thats the core of my problem that I need to learn.

Aug 31, 2010 at 06:16 PM Will 11

You could use GameObject.Find("First Person Controller").GetComponent("MouseLook").enabled = true; to disable a MouseLook script attached to a GameObject named "First Person Controller".

Aug 31, 2010 at 06:54 PM BinaryCaveman
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments



asked: Aug 31, 2010 at 05:40 PM

Seen: 1788 times

Last Updated: Aug 31, 2010 at 06:13 PM