Snarkpit Articles


This tutorial is basically a continuation of my tire swing tutorial, which describes how to make a hanging prop that will move around if shot, but with different props and dynamic lighting. So having read that tutorial, make a light using similar methods:



I have used the props_c17/lamp_bell_on.mdl model for the prop_physics in this example.

Before you start reading on, all your entities and your
prop_physics must be named. I will be using these names for this tutorial:

prop_physics = dynamic01_lamp01
move_rope = dynamic01_rope01
keyframe_rope = dynamic01_keyframe01
phys_lengthconstraint = dynamic01_constraint01

Swinging light



Now, go into the properties of your prop_physics light. Now, this is very important: you MUST change it from a prop_physics to a prop_physics_override. This is done from the drop down menu where it gives the name of the entity currently selected. After that change is made press apply.

Now it's time to create the light that will follow the lamp and light up the area the lamp points. Create a light_dynamic right below your lamp. Press enter to create it. When you do you should notice that your 3D View gets filled up with all sorts of lines and cones and stuff.



That?s what if should look like. Go into the properties of your dynamic light. Set these properties:

name = dynamic01_light01
parent = dynamic01_lamp01
pitch yaw roll = 90 0 0 (this is down)
brightness = 4 (4 is the maximum and 0 is minimum, you may need to play around abit)
Spotlight end radius = 200 (This is quite large, you may want to fool around. It is the radius of the big white cone you see in your 3D view)

Make sure you press apply to set all these changes.



Run your map and hopefully you have something that looks like that. Now, HL2 doesn?t recognize light_dynamic as a light source and sets the map to fullbright by default if you don't have any other 'normal' lights. If this is the case, go into your console and type sv_cheats 1 and then mat_fullbright 0.

If after you do that you don?t have something that looks like the picture, one thing you might want to try is selecting your light_dynamic and looking in your side view- there should be a circle. Drag this so it?s the size of your room and press apply. Another thing you should check is your brightness. The brightness is VERY important: if it is 0 then you will have no light at all, so make sure it is at 4.

Spotlight effect



When that is all working, and you?ve had some fun shooting your light around the room, its time come back to Hammer and add a spotlight. Create a point_spotlight entity right below your lamp. Go into its properties and set these following settings:

name = dynamic01_spotlight01
parent = dynamic01_lamp01

You might want to tick the no dynamic light flag too as we've already got a light source and doing so will save processing power. Now press apply, and compile/run your map!

You should have something that looks like this:



And that?s pretty much it. You may want to add a dim light in the room so you can sort of see the walls. But besides that, this tutorial is over.


Post ReplyView Topic
Discussion
0 starsPosted by Mariowned on Fri Oct 27th 2006 at 11:42pm

This tutorial helped thanks

at the top of this page there is a link for "tire swing tutorial"
the link is wrong... it says .com and should say .net

just wanted to point that out
0 starsPosted by novalin on Wed Dec 7th 2005 at 7:57am

I get the origin rope problem as well and have not been able to solve it. smiley
0 starsPosted by Rambo on Mon Jul 18th 2005 at 11:57am

Hey i tryed doing this and i cant not do it !!! the light fitting isnt there but i can see light and the light swings around but no light bolb or anything so would u be able to help me by sending me a map with just the swing light in it to give me an idea this would be a big help Thanks well look at that i just worked out i cant make glass can u include it in the smaple map if u make it that is Thanks
0 starsPosted by Telmisumor on Sun May 1st 2005 at 6:51pm

0 starsPosted by Sp3ctre on Wed Jan 19th 2005 at 3:10pm

"When i make the light dynamic, it dosent show any cones or any idea where it is pointing... help"

Make sure the light doesn't intersect the lamp. try first without a lamp model

BTW i'm trying to add this to a multiplayer map. I used a prop_physic_multiplayer instead of the override, and everything works fine!
And: i suggest to increase the amount of the mass and inertia scale otherwise the lamp will start making crazy bounces and ceil trepassing...
0 starsPosted by g0tm*/k on Wed Jan 19th 2005 at 6:37am

When i make the light dynamic, it dosent show any cones or any idea where it is pointing... help?
0 starsPosted by omegaslayer on Tue Jan 11th 2005 at 11:45pm

Good tut. Do note that dynamic lights take up a lot of resources in the source engine, place them sparingly. Also to cut the amount of resources used by the source engine through dynamic lights, just increase the light-map size of the surrounding area. A light map scale of 32 will render the dynamic lights better than a scale of 16.
0 starsPosted by Pericolos0 on Tue Jan 11th 2005 at 11:41am

Cool ive done this before and u can create some very neat effects with it if done properly. The only thing i sortoff hate is that is totally messes up de looks of normal mapped textures
0 starsPosted by Leperous on Sun Jan 9th 2005 at 6:04pm

If that's happening I think it's because you have a problem somewhere else, either with the rope or with the prop.
0 starsPosted by Random on Sun Jan 9th 2005 at 5:42pm

I've gotten that glitch before
Post ReplyView Topic