Double Pendulum
Post Reply
Quote
Re: Double Pendulum
Posted by RealEschaton on Thu Jan 6th at 4:15am 2005


So I've got a decent idea for a gimmick for a HL2-DM map, using a pendulum attached to the base of a larger pendulum (aka a double oscillator). I even built one that works pretty well, swinging down twenty stories and crushing any hapless player caught beneath it with the force of a speeding train. Here's a shot of it from my test map (it's taken in Hammer... so shoot me):

Anyway, my problem is that it doesn't swing long enough, reduced to hanging limp after about 30 seconds. If you've never seen one of these things in real life (they're much smaller of course), a well-oiled one can continue swinging for several minutes at the minimum.

Since the pendulum is intended to be a major hazard in the trench it swings through, I need it to continue swinging for a long time at a speed fast enough to squish a player. I was hoping someone on these boards could offer me one of the following:

  • Some way to reduce friction to zero for the entire setup. As far as I can tell, the hinges already have zero friction, so the energy loss must come from somewhere else. This is by far the optimal solution.
  • A setup that inputs energy into the system somehow to keep it moving, without causing unnatural motion.
  • And the last resort, a control system that can quickly reset the double pendulum to its original position.




Quote
Re: Double Pendulum
Posted by aonomus on Thu Jan 6th at 4:57am 2005


Well you could use a angular motion sensor on the large pendulum to determine when to turn on a phys_motor to lengthen movement time.... or just add phys_thrusters and fiddle with weight/mass values




Quote
Re: Double Pendulum
Posted by RealEschaton on Thu Jan 6th at 5:19am 2005


? quoting aonomus
Well you could use a angular motion sensor on the large pendulum to determine when to turn on a phys_motor to lengthen movement time.... or just add phys_thrusters and fiddle with weight/mass values

I've considered those options, and have actually built a test case where a phys_motor cranks the large pendulum back into position. Unfortunately, it's a somewhat jerky motion and I have yet to dabble in angle sensors so I have no way of automatically initiating it when movement ceases (without just using a timer).

Using thrusters is what I'll probably end up doing if no one has any ideas about reducing friction. It seems like this sort of thing should be relatively straightforward, but it's possible that all func_physbox objects are affected by air resistance so much that they will always come to a halt.

The devil's in the details; working with either of those options requires a complex cluster of dependent entities and a ton of fine tuning to get working perfectly; I was hoping for an easy way out.





Quote
Re: Double Pendulum
Posted by Leperous on Thu Jan 6th at 11:57am 2005


/offtopic: One of my maths professors proved that several pendulums attached together can be made to stand upright if oscillated fast enough. I wonder if the Source engine realises this

A phys_hinge entity has a friction property you can specify, so perhaps you can attach the pendulums with one of these entities instead?





Quote
Re: Double Pendulum
Posted by RealEschaton on Thu Jan 6th at 9:19pm 2005


? quoting Leperous
A phys_hinge entity has a friction property you can specify, so perhaps you can attach the pendulums with one of these entities instead?

That's the entity I'm using, and I have the friction in both of them set to zero (default). I'm going to try assigning everything to a constraint system, maybe the "fighting each other" that's described in the help is causing energy loss somehow.





Quote
Re: Double Pendulum
Posted by Quaver on Fri Jan 7th at 1:01am 2005


I think its to do with where its center or gravity is, i havent really caught on to the physics system and contraints, to used to hl1. [addsig]



Quote
Re: Double Pendulum
Posted by SaintGreg on Fri Jan 7th at 4:11am 2005


Lep, would that oscillation be constant, or aided by some feedback mechanism? I can't imagine how even a single upright object could be stabilized by constant oscillation.

- I tried making a simple rotating door on a phys_hinge and even with friction at 0 it slows down. Have you tried making it negative though?




Quote
Re: Double Pendulum
Posted by mazemaster on Fri Jan 7th at 5:36am 2005


Isnt the double pendulum a dynamical system? (can exibit chaotic behavior depending on starting conditions) [addsig]



Quote
Re: Double Pendulum
Posted by Tracer Bullet on Fri Jan 7th at 5:53am 2005


? quoting Leperous
/offtopic: One of my maths professors proved that several pendulums attached together can be made to stand upright if oscillated fast enough. I wonder if the Source engine realises this

Do you mean he actually located a local minimum in the potential energy curve? My experience is that Math Profs tend to be a bit out of touch with reality

Even if there is a local minimum, there could well be enough energy in the system to get it over the activation barrier one way or another...

[addsig]




Quote
Re: Double Pendulum
Posted by RealEschaton on Fri Jan 7th at 7:30am 2005


To answer mazemaster's question, yes a double pendulum does exibit behavior that varies greatly based on small changes in initial configuration. I'm sure someone with a background in chaos theory could talk in more detail about it, I just think it looks cool .

I have no doubt that in the abstract world of mathematics, it may be possible to maintain a system of vertical pendulums using certain oscillations, but even if it were possible it would be an unstable equillibrium. One atom out of place, or one rounding error in the quadrillionths column would eventually cause it to become dislodged. I can't think of any system of pendulums that would create a stable equillibrium while sticking straight up.

I've had no luck in reducing the friction, but I have come up with a solution that works OK. I've got a small system of func_tracktrains that move around in a square, and hoist the "upper arm" section of the two massive double pendulums. When they hit you, you feel it... depending on how you get hit the corpse velocity sometimes has to be capped by the engine.





Quote
Re: Double Pendulum
Posted by Chrasher on Fri Jan 7th at 11:52am 2005


what u could do is use some kinda prop_dynamic model becouse the dynamic models never slow down and make a func_physbox around it and set the flag " debris dont collide whit player or other debris . then make the prop_dynamic parent to the physbox . ingame the dynamic model will just push back every thing that blocks it .






Post Reply