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 lukedabest05 on Thu Oct 12th 2006 at 4:07pm

I did it all, but my tree dunt show wen i actually play it. why?
0 starsPosted by novalin on Thu Dec 8th 2005 at 6:37am

I heard of a parent bug causing this and tried the supposed fix, but I still get this problem. rope shoots over to origin of map.
0 starsPosted by novalin on Wed Dec 7th 2005 at 3:09am

I had the same porblem as SVIN. the rope is connecting to it, but instead is shooting over to a wall. the tires swings fine, but the rope, instead of connecting to the tire, is conntecting to a far off wall. How do I fix this?
- novalin
0 starsPosted by stino on Thu Aug 4th 2005 at 10:49am

Css does support cables, only the rope entities can't be parented to an object in css, don't know why, and could be fixed since the last time i've tried it.
0 starsPosted by bluppfisk on Sat Jun 11th 2005 at 11:28pm

Good tut! works just fine for me in hl2dm. Apparently the tire swing is a deadly tool. Never knew a tire on a swing could hurt one so much. Also, the tire just swings through the tree (not only the rope, but also the tire), that's a bummer for realism.
0 starsPosted by scoobs on Sat Mar 12th 2005 at 12:32am

0 starsPosted by sixsixtysix on Mon Jan 24th 2005 at 11:25pm

I've been having the same problems as deltamagnum, in hl2 i can do it just fine, but in cs:s it goes to the origin.
0 starsPosted by RabidMonkey777 on Thu Jan 20th 2005 at 4:17am

CS:S does support cables. Your problem may be in that you copied the cable setup so it has the same names and gets confused.

As for the tutorial, fairly informative, could use a bit more detail perhaps, but good in any case.
0 starsPosted by deltamagnum on Wed Jan 19th 2005 at 1:17pm

Well i have a bit of an alteration of this and cant seem to get it to work. i followed everything you said, but instead of using a props_physics model i made some brushes into the shape i wanted and made them a function_physbox_multiplayer, also instead of 1 wire i have 2. The problem im having is that when i walk up to my object and shoot it, it reacts like it would if the cables were connected however the cables appear to go from where i told it to start to the origin of the map. Does anyone know how i can fix this?

The problem may be that im using it in a counter-strike source map. Does anyone know if counter-strike source supports cables?
0 starsPosted by Slayd on Mon Jan 17th 2005 at 1:31am

Good tutorial, but how do I make it so that the tire will fall if I shoot the rope? I have a use for that with a similar application, and I can't figure it out.

Thanks,
Post ReplyView Topic