- Home /
Custom Collision
i hv imported a Table Lamp in .fbx format.... i wish to hv such that when i click on d switch in d model...the light should switch on/off... i hv written d script.... bt ths script is applied all over the Table lamp model... hw do i run ths script..onli whn d user clicks on a "part" of the model(ie The switch) plzzz help...:-)
You seem to be missing some buttons on that keyboard.
Yeah, there's no 160 character limit here! Bad spelling and omitted grammar are just laziness.
Answer by adrenak · Feb 20, 2012 at 06:43 PM
I agree with OrangeLightning there lol! Anyways here's how i would have approached your problem:
have a script with a raycast from the camera in the forward direction.
Detect when the user presses the button assigned for switching on the light. When this happens, check whether the ray was hitting the switch or not.
if the ray did hit the switch, then access the light and invoke a function in a script that is attached to the light. This function checks if the light is on, if it is on then it switches it off and vice versa.
There is plenty of information on this Webste and also the manual to help you with the coding. Try doing it yourself if you have got a basic idea.
I Hope this helps!
Oh,I am sorry for using the sms lingo here OrangeLightning.(Innovative name) Yes,I get it VatsalAtTrifekt.Thank you so much!!
Your answer
Follow this Question
Related Questions
Collision with light 1 Answer
Light on contact 1 Answer
,How to add value to a Light range that is counting down. 0 Answers
Light Colision 1 Answer
Light rarely turns on 1 Answer