Tutorial: Physics in Source Last edited 2 months ago2024-09-16 22:22:40 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
Okay so a lot of you are new to Half-Life 2 mapping and you wonder how Valve created objects in their maps that had physics. There are many different physic entities and they are used differently depending on what prop model you use:

prop_physics

This is the entity on the right hand side
prop_physicsprop_physics
This is the main entity that you use to create the realistic physic objects like chairs and tables. Half-Life 2 relies more on props which is short for Models and is what you use to fill a room with nice looking models:
Gas bottlesGas bottles
In this tutorial we will make a simple physics bundle that can be used as a cool trap against enemies.

Now first off start by making a simple room and choose prop_physics on the right
prop_physics...againprop_physics...again
Now click on the place you want the object to be but don't worry because you can move it later on.
Empty roomEmpty room
Now click edit, properties and it should bring up a box.
prop_physics propertiesprop_physics properties
Click on models and then browse...

It will bring up a list of models to use and they are all put in different folders depending on their theme.

For example if I wanted a chair from City 17 I could double click the props_c17 folder and scroll down till I find FurnitureChair001a.jpg. Double clicking it will bring you back to the previous box but on the camera screen you will see your selected model.

That is the basics of a physics objects and you can use props to make rooms look more realistic but what about props with a use to it?

Do all of the previous actions above until you get to the model selction screen and double click the Props_c17 folder again. Scroll down until you find the oildrum001_explosive.jpg and select it. You will be back at the menu and can view your model on the top left screen.
Exploding BarrelExploding Barrel
Now the physic objects are coded so they do as they would in real life e.g. if you compiled the map now you can shoot the explosive barrel and it will explode killing you and enemies around it. Now place a few npc_combine next to it and try it out, you will enjoy seeing enemies fly.

prop_static

Not all physic objects have physics in them such as clock01.jpg and so they can't be made using prop_physics otherwise the Valve compile tools will just delete them from your map. The entity you use to make objects not have physics but stick to walls or the floor is prop_static. prop_static is used mainly for the objects that can't be grabbed by the gravity gun weapon because some models have no backs like this:
Static modelStatic model
This means you can't allow the player to see behind it and so it must be used as a prop_static.

But not all objects are like that and can still use physics but how did they make the toilets stick to walls? If you made a prop_physics now and chose the toilet it would just fall onto the floor so how did they do it? Simple! In properties click on the flags tab and you will see many options!

Just choose Motion Disabled and leave the rest as they are and now when you play the map it will float like a static but as soon as you grab it with the Gravity Gun it will fall and the physics will renable. It will take a while to know which props are physics and which are not but you can tell later on when the compile tools say: Error! prop_static using model "models/props_c17/FurnitureCupboard001a.mdl", which must be used on a dynamic entity (i.e. prop_physics). Deleted.

You will then know to change it and it's that simple.

These are the basics of physics and now you know how to: But what about objects that are not in the list that you really want to use in your map!

Well you can make them yourself using a model program which requires some learning or you can simply make a brush object like a block and tie it to physics!

Func_physbox

This is the entity you use to turn a simple brush object into a physics object that can fall like the props and also damage other things like enemies! This is not in the Entity list tool but it is a tie-to-entity selection that is simple to use.

First make a brush based block and make it hover off the ground quite high! Now click on Tools at the top and choose Tie to Entity...

This will bring up the properties box like a normal entity property except you can choose what you want it to be e.g. we want it to have physics so we scroll down and choose func_physbox:
PhysboxPhysbox
You now have a brush object that is tied to physics but what if it breaks? What material will it shatter into? Its default is glass and that's notn good is it?

So in properties click on either 'Prop Data' which is the simple and quick way or choose 'Material Type' and strength and select the ones you want.

Now compile the map and it will fall like physics and you can move it around with the Gravity Gun.

I have found the func_physbox to be quite buggy because often lightmaps don't effect it and it will often flicker black which looks bad in maps!

Again those are the 3 simple physic entities which you use in maps to make your maps more fun and interesting to look at.

The more advanced use of physics is combining them to make traps, tools etc e.g. the Ravenholm spinning blade trap:
Blade Trap

You can also make fun interesting traps like the helicopter:
Helicopter Trap

4 Comments

Commented 16 years ago2008-02-23 18:31:37 UTC Comment #100730
Hehe I see this transferred well to TWHL3. I noticed a spelling mistake AND I said that the clock has to be set to static when in fact it has to be physics despite the missing behind...Oh well :D
Commented 16 years ago2008-09-10 02:16:47 UTC Comment #100731
thanks!
Commented 16 years ago2008-10-30 03:06:50 UTC Comment #100732
how do you, or can you make func_physbox pickupable?
Commented 15 years ago2009-01-26 04:06:21 UTC Comment #100733
You have to give it a light weight figure for it to be pickable. You can even give it presets like "Rock Light" which will be pickable with the gravity gun.

You must log in to post a comment. You can login or register a new account.