WiseHangLamp: Swinging Lights

From Valve Developer Community
Jump to: navigation, search


This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.

In this tutorial I’m going to illustrate two different types of Swinging Lights, one for HL2/HL2DM and one for CS:S.

HL2/HL2DM

Create a prop_physics:

  • Name: Lamp01
  • World Model: models/props_c17/lamp_standard_off01.mdl
  • Disable Shadows: Yes
  • Flags, Prevent Pickup'

Place this prop exactly where you want it.

Create a keyframe_rope on top of the lamp.

  • Name: KeyFrame01
  • Parent: Lamp01


Create a move_rope on the ceiling, or whatever the top most point is.

  • Next KeyFrame: KeyFrame01
  • Width: 1
  • Texture Scale: 1


Create a phys_ballsocket at the top most spot. This will be the joint/hinge.

  • Entity 1: Lamp01


Place a point_spotlight inside the lamp, where the light will originate from.

  • Parent: Lamp01
  • Pitch Yaw Roll: 90 0 0
  • Adjust the Length, Width and Color to your liking.
  • Flags: Start On, No Dynamic Light

When put together all of the entities above will look like this in Hammer:

wiseSwingLamp01.jpg

And this is the way it will look in the game:

wiseSwingLamp02.jpg

This lamp will now swing when hit. The light will move with the lamp. Since we flagged No Dynamic Light the lamp will not shine light onto objects. You can uncheck that flag but allowing dynamic light may hurt game performance. Experiment with that setting, for performance and lighting effects. Dynamic light is great but it can cause strange effects in your maps.

CS:S

Create a prop_physics_multiplayer and place it where you want.

  • Name: Lamp01
  • World Model: models/props/de_prodigy/lighthanging.mdl
  • Disable shadows: Yes


Create a phys_ballsocket at the ceiling, or top most “hinge” point.

  • Entity 1: Lamp01


Place a point_spotlight inside the lamp, where the light will originate from.

  • Parent: Lamp01
  • Pitch Yaw Roll: 90 0 0
  • Adjust the Length, Width and Color to your liking.
  • Flags: Start On, No Dynamic Light


The concerns with dynamic light are the same as in HL2/HL2DM above. This is the way your completed lamp will look in Hammer.

wiseSwingLamp03.jpg

And this is the way it will look in the game.

wiseSwingLamp04.jpg

See also