Collision response calculation doubts and issues
I hope that I'm posting in the right section of the forum. If not, I kindly request a moderator to move the thread to the proper section. Thanks in advance.
I'm currently working on a prototype of a 3d simulator in which entities 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. 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 the moment of volume 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? :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, my library 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 of about 0.05 with no rotation 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 lower vertexes, i.e. (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
Following the value I've given to the Inertia tensor 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. :frown: If it is the second case, please, be polite! :cry:
Any help, any clue, anything that can help me is really appreciated!
|All times are GMT -5. The time now is 09:22 PM.|
Powered by vBulletin Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2014 Physics Forums