1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Collision response calculation doubts and issues

  1. Feb 29, 2012 #1

    I've already posted this same question in another forum section but probably it was the wrong one and the post was deleted, according to the rules. My apologies for the big mistake. Sorry. :approve:
    I try to re-post the same question here, hoping it is the most suited section.

    I'm currently working on a prototype of a 3d simulator in which entities (rigid bodies) of different shape and mass move possibly colliding. Since my physics knowledge is (really) rusty I've searched the Internet for some data and I found out the "impulse-based" approach. I've tried to implement it following the Wikipedia formulation and double-checked it with Baraff's papers, in particular "Rigid Body Dynamics II". Unfortunately something is wrong about my implementation or I'm missing something (or both!). Actually, I'm a lot confused about the mathematical part and I can't understand where and how I'm doing wrong. Thus, sorry in advance if the following questions are stupid, but I really need to shed light on my doubts.

    Most of my doubts are related to the Inertia Tensor. I've read online that in the case of a cube aligned at the origin it is a diagonal matrix with value 1/6 * m * l^2 with l equal to the length of the side. Which means a matrix with diagonal values of 0.666... for a box of side 2 and mass 1.
    1) Is that correct?
    2) I use V-Clip library for collision detection. Such library returns an Inertia Tensor with diagonal values of 0.1666 for a cube of side 1 and 5.3333 for side 2 (mass is always 1). It calculates the tensor on the basis of the first and second moment of volume and the product of volume. I didn't find much about them on the Internet, hence this part is totally unknown to me. Is that a correct tensor? The value is completely different from the values I've calculated as explained in the previous paragraph. Which one is correct? Both? :confused:

    Another question is about the point of application. As I understand, differently from the impulse-based formulation without rotation, the impulse magnitude is influenced at the denominator by the offset of the contact point from the center of mass. Thus, choosing the wrong points can result in a wrong response. Right? Moreover, V-Clip does not return the contact point but the nearest points of the two entities. Until now I've calculated each offset to each point on the two polyhedron. I suppose it is better to calculate the middle point between the two as the contact point, right?

    I've also tried to calculate by hand a simple example but really, there's something I'm doing the wrong way. I considered two cubes, one has mass 1 and side 2 (diagonal matrix value 0.666... according to what I've said) the other has same side but infinite mass (simulate a wall).

    One is moving with velocity (5,0,0) the other is obviously motionless. The center are at (5,0,0) and (7.05,0,0) so that their distance is exactly 0.05. No rotation is applied so that two faces are almost touching and perfectly parallel.

    Since the two faces are parallel, any point over them has the lower distance. Following V-Clips, I considered as contact points the same couple of vertices returned by V-Clip: (6, -1, -1) and (6.0.5, -1, -1). The norm to the collision plane is pointing towards the second block and its value is obviously (1, 0, 0).

    Following the formulation of wikipedia the numerator of the impulse magnitude has value (inelastic collision --> e = 1, no rotations):
    -(1 + e)* v_r . n = -(1 + e)* (v_2 - v_1) . n = -2 * (-5, 0,0) . (1,0,0) = 10

    Given the value for the Inertia tensor discussed above, the denominator has value:

    m_1^-1 + m_2^-1 + (I_1^-1 (r_1 x n) x r_1 + I_2^-1 (r_2 x n) x r_2) . n =
    1 + 0 + (I_1^-1 ((1, -1, -1) x (1,0,0)) x (1, -1, -1) + I_2^-1 ((-1, -1, -1) x (1,0,0)) x (-1, -1, -1)) . n =
    1 + 0 + (3 + 3). n = 7

    In this simple case the denominator must be 1, to have a magnitude of 10 and thus a correct final velocity of (-5,0,0) for the first polyhedron. Jesus, I feel so stupid! I'm totally messing up something, maybe everything. If it is the second case, please, be polite! :cry:
    Any help, any clue, anything that can help me is really appreciated!
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Discussions: Collision response calculation doubts and issues