Snarkpit Articles


This tutorial will show you how to create a tire swing with physics and constraints, and give beginners a quick lesson in some physics.

Obviously, start by making the area you want your tree and tire swing.

Create a prop_static entity, and browse for the model in the prop_foliage folder. I use tree_deciduous_01a.mdl- make sure the area you want it in is big enough!



Now its time to create the visual part of the tire swing. Select the move_rope entity and create it on one of the branches. This will take some fooling around in the top and side views, but use the 3D view to position it exactly- the centre of the entity should be inside the branch for best looking results.



Name it swing_rope01, set its slack to 0, and set rope material to cable/rope. There are other optional properties you can set which we leave to you to sort out.

Now create a keyframe_rope entity below the move_rope, a bit above the ground. Make the distance from the move_rope to the keyframe_rope as long as you want the rope on your swing to be.



Name it swing_keyframe01 and press apply. Now go back into the properties of our move_rope. Set the Next KeyFrame property to swing_keyframe01 and press apply. When you do this you should see a green/red line in Hammer linking swing_rope01 and swing_keyframe01.

Now its time to create the tire. Create a prop_physics entity and select a tire as the world model (they can be found in the prop_vehicles/ directory). Move this in your 2D views so it is right below our keyframe. The middle of the keyframe should be along the top surface of the tire.



Go into the properties of this tire and name it swing_tire01. Now go back into the properties of our keyframe_rope and set the Parent to be swing_tire01- this will connect one end of the rope to the tire.

If we tested this now the tire would fall to the ground, as the rope doesn't really have a fixed length yet. Create a phys_lengthconstraint entity in the same place as the keyframe_rope and name it swing_constraint01. Set Entity 1 toswing_tire01 and press apply. Keep the lengthconstraint selected and zoom into it in your side view. You should see a little circle in the middle which is the entity origin. You want to drag that little circle up and into the middle of our move_rope entity. This will basically give the tire swing constraints so that it won?t stretch all over the place- the distance defined by the constraint is that between the entity itself and the white circle we just dragged.



Now create a player start and test your map! You may notice that it's not terribly realistic- the rope won't get twisted around the tree, for example- but there's nothing you can do about this.



Post ReplyView Topic
Discussion
0 starsPosted by Quaver on Tue Jan 4th 2005 at 4:20pm

I was trying to do this the other day without any luck, i was using prop_physics. Good tutorial
0 starsPosted by parakeet on Tue Jan 4th 2005 at 1:45pm

Although it wasnt very information packed it did exactly what you told us...
Post ReplyView Topic