torch

got scripts? Need scripts?
Post Reply
SweetRevenge
Posts: 52
Joined: Sun Jul 04, 2010 4:53 am

torch

Post by SweetRevenge »

ok, I want to make a torch for my player to hold while he is traveling through dark areas or whatever. I want to make a spawn point in the players left hand, and when lets say F is pushed, I want the torch to appear, and when F is pushed again the torch is detroyed. Can anyone help please?
SweetRevenge
Posts: 52
Joined: Sun Jul 04, 2010 4:53 am

Re: torch

Post by SweetRevenge »

kinda to go along with this, how can i completely turn out all of the lights in unity?
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: torch

Post by hallsofvallhalla »

should just be able to make the light or torch and turn it into a prefab. then just create a instance of the prefab when button is pushed.
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: torch

Post by SpiritWebb »

Take a look at the FPS tutorial that Unity offers found here: FPS Tutorial. In there it has swapping of weapons between numbers 1 and 2. You could easily use that to compensate for the "F" press to show the torch and put it away. As for the lights, you could add a light source to the torch and it activates when pressing "F." It will take a little scripting to do, but will achieve the end result. I have this in my space game. When pressing "E" the ship begins to move and the lights turn on and flames come out to give it that "look."

You can find that result on how to achieve that by looking at the 3rd person tutorial that Unity offers found here: 3D Platform Game - 3rd Person

Take a look at both of those tutorials, combining pieces of both should achieve what you are looking for!! :)
Image

Image
Post Reply

Return to “Scripting/Coding”