Generalizing collision normal between two arbitrary shapes

Click For Summary
SUMMARY

This discussion focuses on calculating the collision normal in a physics engine, emphasizing that it cannot be simplistically assumed to be [1,0]. The proposed method involves determining the vector between the centers of two bodies, using the atan2 function to calculate the angle, and then deriving the normal vector using cosine and sine functions. It highlights the importance of considering the tangent plane at the point of contact and the relative velocity direction when defining the collision normal.

PREREQUISITES
  • Understanding of vector mathematics and operations
  • Familiarity with collision detection algorithms
  • Knowledge of physics concepts related to collision response
  • Experience with programming in a physics engine context
NEXT STEPS
  • Research vector mathematics in game physics
  • Learn about collision detection techniques in physics engines
  • Study the role of relative velocity in collision response
  • Explore the implementation of tangent planes in collision calculations
USEFUL FOR

Game developers, physics engine programmers, and anyone involved in simulating realistic collision responses in virtual environments.

StarWarsNerd
Messages
19
Reaction score
1
I am working on a physics engine, and I have a question about the collision normal. There are a lot of different ways people say to calculate this, perpendicular to the collision angle, perpendicular to the edge of body 'B', etc. I was wondering if it would be okay to assume the collision normal is always [1,0]. If that is not okay, is this:
  • vector = distance(A.Center, B.Center)
  • angle = atan2(vector.Y, vector.X) + PI / 2
  • normal = [cos(angle), sin(angle)]
 
Physics news on Phys.org
Not sure how you are defining collision normal, but basing it on the line joining the mass centres does not sound right.
First, there is the question of the tangent plane at the point of contact. The normal to that could be considered a collision normal.
Next, there is the relative velocity. The direction of that vector is also relevant.
 

Similar threads

Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 17 ·
Replies
17
Views
4K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 157 ·
6
Replies
157
Views
13K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
9
Views
13K
  • · Replies 14 ·
Replies
14
Views
2K