h1

pivot constraints == awesome chain physics!

November 17, 2008

In the past, I have had two different kinds of inelastic distance constraints: single distance constraints (rat_constraint_bar) and min/max distance constraints (rat_constraint_slider).  I add a new one called the pivot (rat_constraint_pivot).  Why, you ask?

Well, you might think a distance constraint with a length of zero is sufficient, but it isn’t.  Here’s why: a distance constraint uses the normal of the distance “bar” to decide how to pull or push the anchor points.  If you are a point, this value cannot exist unless the objects are separated, which means the constraint will never keep the anchors at zero distance from each other.  Furthermore, this means the pivot will never react like a revolute joint, because this behavior relies on a shared point.  So, the key is to compromise.  We use our old friend bias velocity (pseudo velocity) to keep the points together, regular distance constraint style.  But in order to get the correct pivot behavior out of it we have to calculate the impulse as if, like I said before, the anchors share a point even if they don’t.  This means instead of normals, we must create a mass matrix to get the correct torque, then apply the equal offset impulse to the anchors.  Think of it as unbreakable sticky friction.

The really cool looking result can be seen in the following video.  I can now have real segmented chains; solid segments, not distance constraints between particles!  🙂

Advertisements

3 comments

  1. DUUDDDDDDDDDDDDDDDDE

    I’m so jealous, I’m serious! WTF. You are programming cool and awesome things and I just sitting here twiddling my thumbs. Damnit, I wish I started out like you programming… Doing physics and optimizing the shit out of it.

    Dude, I got to work harder!!!

    Did you know there is really no such a thing as natural genius. It’s all about doing, doing, and more doing. Practice makes perfect, literally. If you put in say 7 years into something you become TRULY an expert. Once you’re on that level you gets to PWN people…It’s that simple. PWN OTHERS BRAH!

    Damnit… I feel depressed now. But I can’t give up.


  2. Yes. I actually did know that. One of the reasons the average intelligence of humanity is dropping is because people think you’re born with that shit, and if you happen to be smart, everything falls in to place. The truth is, I’ve been bombarded since infancy with lessons and info, and I was introduced to programming and science when I was five. Electrical engineering at ten. That’s 13 years in programming and 7 years in electronics. Before that I was taught arithmetic by my father and simple geometry at 3-4. And even farther back, my parents spoke to me so constantly as an infant, that my symbolic register developed speech capability at 8 months. I firmly believe I am NOT superior in any way, rather, the way I was taught is superior. I can do what I do because I was told I must work at everything, and that knowledge is the ultimate pursuit. Like you said, it’s all about practice makes perfect. To reach enlightenment you must think, to think you must know, to know you must see, to see you must do, and to do you must feel. Therefore, if you do not feel you must do, you will never start down the path to enlightenment.

    And BTW, you understand things about shaders I don’t, so don’t think you’re all uncool or something. In fact, there is a whole field of advanced graphics programming that you know a lot in, which I know nothing in. You also must have some kind of mad skeelz, or you couldn’t have done what you’ve done so far in Project Zombie. PZ is the shit. I look forward to playing at massive scale Zombie survival. 🙂


  3. My dad was an slacker artist, that’s all I have to say about that.

    Anyway, yeah, the high-level stuff is nothing, you just have to sit down and grind through it. (Mainly for me since I did also majored in math so I can speak the language, if you will.) But for you, you have a very solid foundation, all you need to do now is to just grind through it, and it will be smooth sailing from here on out. I’m not saying it’s a free lunch, but you have a great start now.

    I get depressed because I want to become an expert. I just got to work harder, I guess. I’ve had a few bad experiences and false starts in my life, I’m nothing like you, I wish I gotten “on your track” like you, as early as you did. I would be at a much higher level than I am now.

    But I can’t regret it. No. What’s done is done. Just have to push forward.

    Another thing, since my last job, I sort of slacked. You know I did programming at work, then coming home I just felt like hanging out with friends, and not putting in “the time.” This time thought, when I start work again, I’m not going to slack off. I’m going to keep on working at it.

    Peace.

    I will download your source later today and compile it.

    BTW: Work hard. But also have some fun in college. I don’t mean goto frat parties every tue/thu/fri and sat. I mean have some fun. GO OUT and meet other people. You only get college life once. (There is always grad school.)



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: