WiseProps: Prop Physics
This tutorial was originally created by wisemx. It was originally posted on SDKnuts.net.
In this tutorial we will cover:
- How to control interaction with a physical prop.
- Keep the prop from being damaged.
- Allow the prop to be easily damaged.
- Make it hard to damage the prop.
- Explode the damaged prop.
- Respawn the damaged prop.
In the shot below the crates are all the same model: models/props_lab/dogobject_wood_crate001a_damagedmax.mdl
.
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:
2-6 prop_physics
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.