Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

how to deal with collision and time since last collision


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 MARS_999   GDNet+   -  Reputation: 859

Like
0Likes
Like

Posted 16 March 2013 - 10:53 PM

I am thinking that I need to use a timer callback?

I have two objects and when they collide I want to have a set time frame e.g. 5 seconds where if the object collides again I am able to check that and after 5 seconds its reset and waits until the next collision happens...


Thanks

Sponsor:

#2 Bacterius   Crossbones+   -  Reputation: 3860

Like
0Likes
Like

Posted 17 March 2013 - 06:39 AM

Well this highly depends on your implementation, but, without context, I'd say store a timestamp with each object describing the time of the last collision, and upon collision check that the difference between the timestamp and "now" is less or more than 5 seconds, and handle each case accordingly. Either absolute and relative times are fine here for the timestamp, since you are only interested in time differences.

 

But as I said, this depends on a lot of things, and a callback may indeed make more sense depending on your programming language, physics engine, API, software architecture, taste, etc..


"The best comment is a deleted comment."
website · blog





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS