Help finding time between two frames for collision detection

In summary, the conversation is about a programmer who has successfully created a verlet physics engine but is struggling with collision detection and response. They have tried different methods but have not been successful. They are specifically looking for a way to determine when a collision occurs between points and lines that make up different shapes in the engine, as the game runs at 60Hz. A link to a resource on simple intersection tests for games is shared, and the possibility of creating a "stationary" plane by defining a line-fixed coordinate-system is discussed. The programmer plans to try this method later that night.
  • #1
blainiac
50
2
Hey everyone!

I programmed a verlet physics engine that works great. I got to the collision detection and response and it's been frustrating to say the least. I've tried tons of different ways, but no cigar.

The collisions themselves are between points and lines between points. These lines make up different shapes that move around in the physics engine.

Since the game runs at 60Hz, the points can simply hop over a line (which can be moving too). I'd like to know if there's a way to see WHEN between those two frames they actually collide. (so if the first frame, F0.0 had no collision, and F1.0 had a collision, F0.66 would be where inbetween they collided)

Here's a pic to show what I mean...

http://nullium.fileave.com/pointlinecollide.png

Thank you so much!
 
Physics news on Phys.org
  • #2
http://www.gamasutra.com/view/feature/3383/simple_intersection_tests_for_games.php
 
  • #3
Thanks for the link. I haven't looked to deep into it, but could I make a 'stationary' plane by making movement relative? Like, from the 'line's' point of view?
 
  • #4
Nevermind! I didn't see the other 7 pages on there! Haha.
 
  • #5
blainiac said:
Thanks for the link. I haven't looked to deep into it, but could I make a 'stationary' plane by making movement relative? Like, from the 'line's' point of view?

Sure, you could define a line-fixed coordinate-system, and do your collision test threre.
 
  • #6
Thanks, I'll try that later tonight. Thanks for the link again.
 

1. How do I determine the time between two frames for collision detection?

To determine the time between two frames for collision detection, you can use the equation Δt = t2 - t1, where t2 is the time of the second frame and t1 is the time of the first frame. This will give you the time difference in seconds.

2. Why is it important to accurately calculate the time between frames for collision detection?

Accurately calculating the time between frames is crucial for collision detection because it allows you to determine the speed and direction of objects in motion. This information is essential for determining if and when a collision will occur.

3. Can I use the same method to calculate time between frames for all types of collisions?

Yes, the same method can be used for calculating time between frames for all types of collisions. However, the specific equations and calculations needed may vary depending on the type of collision (e.g. 2D vs. 3D, elastic vs. inelastic).

4. Are there any alternative methods for calculating the time between frames for collision detection?

Yes, there are alternative methods for calculating time between frames for collision detection, such as using physics engines or pre-made collision detection libraries. These methods can often provide more accurate results and save time in the coding process.

5. How can I optimize my code for calculating time between frames for collision detection?

To optimize your code, you can use techniques such as caching and reducing unnecessary calculations. Additionally, using vector math and algorithms specifically designed for collision detection can improve performance and accuracy.

Similar threads

Replies
5
Views
787
Replies
1
Views
2K
Replies
5
Views
2K
  • Mechanics
Replies
5
Views
2K
  • Mechanics
Replies
1
Views
2K
  • Programming and Computer Science
Replies
21
Views
3K
  • Introductory Physics Homework Help
Replies
7
Views
1K
  • Special and General Relativity
4
Replies
125
Views
4K
  • Mechanics
Replies
1
Views
4K
Replies
5
Views
4K
Back
Top