Working on a general physics engine

In summary, a general physics engine involves objects with two velocity vectors: rotation and translation. When a collision occurs, the object calculates its translational velocity into two components, one pointing towards the point of collision and the other orthogonal. The former is then applied to the object it hit, taking into account factors such as elasticity. However, the approach for applying the rotational velocity of an object when it collides with another object is still uncertain. One idea is to decompose the rotational velocity into two components, one pointing towards the point of collision and the other orthogonal, and only apply the former to the object it hit. However, this method does not always accurately simulate physics and there may be a better approach to consider.
  • #1
_Nate_
20
0
I'm working on a general physics engine for fun.

Objects have two velocity vectors: rotation and translation. When a collision is detected, objects are told the point of collision (p) and the object that they hit.

The object decomposes its translational velocity into the component pointing towards p and the orthogonal component. It removes the former component from its own translational velocity and applies the component to the object that it hit. (Scaled, of course, by elasticity, etc)

This goes on to calculate equal and opposite reactions, etc. to simulate physics.

However, I don't know what to do with the rotational velocity when object a hits object b. Say that object a is spinning with a rotational velocity of r, and it hits object b at point p (which is direction u from a's center of mass). How is r applied to b?
 
Science news on Phys.org
  • #2
My initial idea is to decompose r into the component pointing in direction u and the orthogonal component (similar to translational velocity). The u-component is applied to b and the orthogonal component is ignored. This works for some scenarios, however, it doesn't always accurately simulate physics.

Is there a better way to apply an object's rotational velocity when a collision occurs?
 
  • #3


It's great to hear that you are working on a general physics engine for fun. Physics engines are important tools in various fields, from video game development to engineering simulations. Your approach to handling collisions seems to be on the right track, as it takes into account both translational and rotational velocities.

When object A collides with object B at point P, the rotational velocity of A should be transferred to B in a similar manner as the translational velocity. The first step would be to calculate the relative velocity between the two objects at the point of collision. This includes both the translational and rotational components. Then, using the principle of conservation of angular momentum, you can calculate the new rotational velocity of B after the collision.

The direction and magnitude of the new rotational velocity will depend on the specific properties of the objects, such as their masses and moments of inertia. It's important to also consider the elasticity of the collision, as this will affect the amount of energy transferred between the objects.

In summary, when object A collides with object B, its rotational velocity should be transferred to B using the principle of conservation of angular momentum. This will ensure that your physics engine accurately simulates the behavior of rotating objects in collisions. Keep up the good work and happy coding!
 

1. What is a general physics engine?

A general physics engine is a software library or program that simulates the physical laws and principles of motion, forces, and interactions in a virtual environment. It is used to create realistic and dynamic simulations of real-world physics for applications such as video games, animation, and scientific research.

2. What are the benefits of working on a general physics engine?

Working on a general physics engine allows for the creation of realistic and immersive simulations, which can be used for various purposes such as entertainment, education, and research. It also helps improve problem-solving and critical thinking skills, as well as provides opportunities for innovation and advancement in the field of physics and computer science.

3. What are the basic principles behind a general physics engine?

A general physics engine is based on the fundamental principles of classical mechanics, including Newton's laws of motion, conservation of energy and momentum, and the law of universal gravitation. It also incorporates concepts from other branches of physics such as thermodynamics, electromagnetism, and fluid dynamics to accurately simulate a wide range of physical phenomena.

4. What are some challenges of developing a general physics engine?

One of the main challenges of developing a general physics engine is creating an accurate and efficient simulation that can handle complex interactions between various objects in real-time. This requires a thorough understanding of both physics and computer science principles, as well as advanced programming skills. Additionally, ensuring compatibility with different platforms and hardware configurations can also be a challenge.

5. How can a general physics engine be used in different applications?

A general physics engine has a wide range of applications, including video games, virtual reality, animation, engineering simulations, and scientific research. It can also be integrated into other software and tools to enhance their capabilities and provide more realistic simulations. In the future, it may also be used in fields such as robotics, healthcare, and disaster management.

Similar threads

Replies
1
Views
937
  • STEM Academic Advising
Replies
11
Views
2K
Replies
1
Views
737
  • Programming and Computer Science
Replies
3
Views
1K
Replies
13
Views
1K
Replies
5
Views
851
  • Classical Physics
Replies
1
Views
944
  • Introductory Physics Homework Help
Replies
11
Views
788
Replies
14
Views
1K
Back
Top