Jump to content
  • Advertisement
Sign in to follow this  

MTD and collision response

This topic is 3032 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, I have successfully implemented SAT purely for the use of detecting collisions, however know i want to resolve them and i would like as much information as possible, firstly how to calculate the MTD and how to use it. My confusion probably comes from me thinking to far ahead but let me summarise it

-To which body to i apply the MTD to stop collision? or do i half it and apply to both?
-What if i dont want one of the things to translate i.e. infinite mass? i havent coded in mass and such yet but that will be the next step
-what collision response methods should i use? i like the sound of impulse method as it allows for objects at rest

also im having a bit of trouble getting the mtd as it stand here is the code

if( minThisPoly > maxOtherPoly || maxThisPoly < minOtherPoly )
return YES; //smallest amounts of test possible to see if the projected points along current axes are not overlapping

float mtd = (maxThisPoly < maxOtherPoly) ? (minOtherPoly - maxThisPoly) : (maxOtherPoly - minThisPoly);

if(mtd < [CInfo MTD])[CInfo setMTD:mtd];

return NO;

its in objective C but the syntax shouldn't confuse you too much. my problem is i've seen you have to use square distances and such and stuff so i do not know how to proceed exactly, i project along an axis which is of unit length
any help or sources or tutorials are greatly appreciated


Share this post

Link to post
Share on other sites
Okay i have just realised one of my blunders, that the MTD should be a vector not a scalar value like im using now...oppsie, and as far as i can tell you apply the mTD to both objects

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!