Forum

Pendulum physics

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby necros » Fri Sep 02, 2011 7:05 pm

you might want to try something simpler than a rope for just a swinging lamp.

instead of treating like a rope, treat it like a ball and socket joint, which is a much simpler problem.

because the lamp is hanging, we know it must always accelerate in such a way as to end up perpendicular with the ground (or parallel with gravity).

you can simple take the dot product of the current direction * '0 0 -1' and use that to determine how much angular velocity you will dump into it each frame.
then just put some simple velocity reduction to simulate friction, and tune the numbers till the movement looks real and you're done.
necros
 
Posts: 77
Joined: Thu Dec 16, 2004 10:32 pm

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest