How can I calculate post-collision rotation in my physics engine?

AI Thread Summary
The discussion centers on calculating post-collision rotation in a Java physics engine after implementing wall collisions with elasticity and friction. The user shares their wall collision method, which involves projecting velocity onto the collision normal and wall vectors, adjusting for elasticity and friction. They suggest that an impulse function could be beneficial, allowing for the specification of velocity at a certain point on the object to determine the resulting rotation. The conversation highlights the need for a more precise approach to handle rotational dynamics post-collision. Overall, the focus is on improving collision response to include accurate rotational calculations.
MTK
Messages
13
Reaction score
0
I implemented collisions with walls in my Java physics engine, complete with elasticity and friction, but I am not sure how to calculate the post-collision rotation. Maybe you can help?

Here is the wall collision method (if you can understand it) :

Code:
public void processWallCollision(Vector normal) {
        Vector wall = normal.rotate(Math.PI/2);
        Vector normalProjection = velocity.projectOnto(normal);
        Vector wallProjection = velocity.projectOnto(wall);
        normalProjection = normalProjection.reverse();
        normalProjection = normalProjection.scale(elasticity);
        wallProjection = wallProjection.scale(1-friction);
        velocity = normalProjection.add(wallProjection);
}
 
Physics news on Phys.org
I am thinking that it might actually be best to have am impulse function (similar to the apply force function), that would set the velocity of a certrain point (instead of increasing or decreasing it) in the object to a specified value, and calculating the velocity ant rotation from that.
 
I have recently been really interested in the derivation of Hamiltons Principle. On my research I found that with the term ##m \cdot \frac{d}{dt} (\frac{dr}{dt} \cdot \delta r) = 0## (1) one may derivate ##\delta \int (T - V) dt = 0## (2). The derivation itself I understood quiet good, but what I don't understand is where the equation (1) came from, because in my research it was just given and not derived from anywhere. Does anybody know where (1) comes from or why from it the...
Back
Top