- Home /
Picking up a flashlight
Hey, so i have a model of a flashlight in my game. I want to be able to pick it up and equip it using "E". I have a spotlight attached to my first person controller, which has its intensity set to 0, so when i spawn i dont have a light and toggling it on or off makes no difference. How would i go about doing this? I have little scripting knowledge.
Oi. This kind of question is difficult to answer because there can be so many different ways to accomplish the desired gameplay. So perhaps I can give you at least a start of what you may need..
Put a collider on the flashlight model, if it's being touched by the character while pressing the E button, then 'turn on' the flashlight by a)putting the flashlight in the players hands and turning on the spotlight.
or you could detect if the player is within X units of the flashlight, and looking at it, and presses the E key. then, 'turn on' the flashlight as stated above.
Overall, check out some Youtube videos on Unity3d scripting and whatnot. You can pick it up pretty quick if you're $$anonymous$$d is set on it.
please mark as answered if you can. Also as a side note, rather than setting it's intensity to "0" simply disable the light component and then re=enable once a condition has been met. (Which is what I think the ShreddieNut is saying)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Very simple picking up items script? 2 Answers
How can i make this animation play only once? C# 1 Answer
Pick up flashlight with "E" ? 0 Answers
Animation flashlight when run 4 Answers