WiseProps: Prop Physics

From Valve Developer Community
Jump to navigation Jump to search


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

In this tutorial we will cover:

  1. How to control interaction with a physical prop.
  2. Keep the prop from being damaged.
  3. Allow the prop to be easily damaged.
  4. Make it hard to damage the prop.
  5. Explode the damaged prop.
  6. Respawn the damaged prop.

In the shot below the crates are all the same model: models/props_lab/dogobject_wood_crate001a_damagedmax.mdl.

The one on the far left did not show correctly because the screenshot is from Hammer configured for Half-Life 2. The prop_physics_respawnable entity is meant for HL2DM, but works in HL2 also.

Two of the crates are a different color. This is done by changing their Skin. You should check HL2 models for additional skins. Some of the other models you can do this with are Trains and the Shipping containers.

In this example from left to right the props are:

1 prop_physics_override

2-6 prop_physics

7 prop_physics_respawnable

The properties and type for the first crate allow us to let the player interact with it but not damage it. This crate can be knocked around and tossed and it will shoot gibs when shot at. The second crate is easy to destroy but can’t be moved. Create 3 will explode when damaged and the explosion will hurt. The next three crates are identical but are, hardest to easy, to destroy. For the 7th crate this type allows us to respawn the crate, in this example it will reappear in 10 seconds.

First crate:

  • Health: 0
  • Skin: 1

Crate 2:

  • Health Level to Override Motion: 10
  • Min Damage to Hurt: 20
  • Flags: Motion Disabled, Not affected by Rotor Wash, Prevent Pickup, Prevent Motion enable on player bump

Third crate:

  • Explosion Damage: 100
  • Explosion Radius: 50

For Crates 4-6 one property changes: Min Damage to Hurt

  • 4: 100
  • 5: 75
  • 6: 20

Crate 7 is our prop_physics_respawnable:

  • Skin: 1
  • Respawn Time: 10

Download the example for this tutorial and play with the properties for these crates.

See also