- #1
CK_KoopaTroopa
- 8
- 2
Hi, I'm trying to program a simple physics engine from scratch as an exercise, and I'm starting with manipulating a stick with the mouse pointer. As of now, it dangles from one end demonstrating simple pendulum physics. Now, I want to add a friction component to the "axle" it's rotating on to avoid perpetual motion, like when you put a pencil through the end of a ruler and swing it back and forth.
I can create this illusion by making a line that says "omega = omega * 0.9" (omega being angular velocity) each frame, because right now I'm bypassing torque altogether and skipping straight to acceleration (which I realized this morning was a terrible idea... I know how to fix this though).
However, even though that appears right when I run the program, it doesn't seem to line up with real-life physics at all. What I need is a torque that goes against the torque of gravity (-m*g*L*sin (theta)); I just don't know how to find what that torque is. I'm pretty sure there's one equation I'm looking for, but I forget how friction works mathematically and I can't find it online or in my high school physics notes for the life of me! Anyone got it?
I can create this illusion by making a line that says "omega = omega * 0.9" (omega being angular velocity) each frame, because right now I'm bypassing torque altogether and skipping straight to acceleration (which I realized this morning was a terrible idea... I know how to fix this though).
However, even though that appears right when I run the program, it doesn't seem to line up with real-life physics at all. What I need is a torque that goes against the torque of gravity (-m*g*L*sin (theta)); I just don't know how to find what that torque is. I'm pretty sure there's one equation I'm looking for, but I forget how friction works mathematically and I can't find it online or in my high school physics notes for the life of me! Anyone got it?