Collision response calculation doubts and issues

In summary: I_2^-1 (r_2...), which in this case would be 1 + 0 + (1/3 * (1, -1, -1) x (1,0,0)) x (1, -1, -1) + 0) + (0 + (1/3 * (-1, -1, -1) x (1,0,0)) x (-1, -1, -1) + 0) = 1 + 0 + (1/3 * (1, 0, 0) + 0) + (1/3 * (1, 0, 0) + 0) = 1 + 0
  • #1
BaCaRoZzo
2
0
Hi all,

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!
 
Physics news on Phys.org
  • #2


Hello,

First of all, don't worry about posting in the wrong section, it's always better to ask for help than to struggle alone. And don't worry about your questions being "stupid" - there's no such thing as a stupid question, especially when it comes to complex topics like physics and mathematics.

To answer your first question, yes, your understanding of the inertia tensor for a cube is correct. It is a diagonal matrix with values of 1/6 * m * l^2, where m is the mass and l is the length of the side. This means that for a cube with a side length of 2 and a mass of 1, the diagonal values would be 0.666... as you mentioned.

As for your second question about the values returned by the V-Clip library, it's difficult to say without knowing more about how the library calculates the inertia tensor. It seems like the values it returns are not correct, as they are very different from the values you have calculated. I would recommend reaching out to the creators of the library for further clarification on how it calculates the tensor and if those values are correct.

The point of application is also an important factor in the impulse-based approach. You are correct in thinking that choosing the wrong points can result in a wrong response. In general, it is better to calculate the middle point between the two entities as the contact point. However, if you are unable to obtain the exact contact point from the library, you can use the nearest points as an approximation.

In your example, it seems like you have made an error in your calculation of the denominator. The correct value would be 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 + ∞ + (3 + 3). n = ∞. This means that the impulse magnitude would be 0, resulting in no change in velocity for the first polyhedron. This makes sense, as the second polyhedron has infinite mass and therefore cannot be moved by the collision.

I hope this helps to clarify some of your doubts and confusions. Keep in mind that physics simulations can be complex and it's always a good idea to double-check your calculations and assumptions. If you continue to have trouble, don't hesitate to
 

1. How is collision response calculated?

The collision response is calculated by using the laws of physics, specifically the principles of conservation of momentum and conservation of energy. When two objects collide, the total momentum and energy of the system is conserved, and this is used to determine the resulting velocities and directions of the objects involved.

2. What factors affect the accuracy of collision response calculations?

The accuracy of collision response calculations can be affected by various factors such as the shape and size of the objects, the material properties of the objects, and the type of collision (e.g. elastic or inelastic). In addition, the precision of the calculations also depends on the numerical method used and the resolution of the simulation.

3. How do you handle complex collisions involving multiple objects?

For complex collisions involving multiple objects, a technique called collision detection and response is used. This involves detecting when objects come into contact with each other and then calculating the resulting forces and velocities for each object involved. This process is repeated for each collision until all objects have been accounted for.

4. Is there a standardized algorithm for collision response calculation?

There are various algorithms and methods that can be used for collision response calculation, and there is no one standardized approach. Some common techniques include impulse-based methods, spring-damper models, and rigid body dynamics. The choice of algorithm often depends on the specific application and the desired level of accuracy.

5. Can collision response calculations be optimized for real-time applications?

Yes, collision response calculations can be optimized for real-time applications by using simplified models and numerical methods that are efficient and fast to compute. These optimizations are often necessary for video games, simulations, and other real-time applications where the calculations need to be performed quickly for a smooth and realistic experience.

Similar threads

  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
7
Views
128
  • Classical Physics
2
Replies
61
Views
949
Replies
1
Views
487
  • Calculus and Beyond Homework Help
Replies
8
Views
897
  • Mechanics
Replies
11
Views
1K
Replies
10
Views
1K
  • Introductory Physics Homework Help
Replies
8
Views
368
  • Calculus and Beyond Homework Help
Replies
8
Views
114
Back
Top