Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Let me explain Phase Lock first: When two objects of non zero mass occupy the same space but have zero energy (no velocity).

Do they bump forever with zero velocity resolution vectors or do they just stay locked together until an outside force interacts?

In my home brewed engine, I realized that if I loaded a character into a tree and moved them, they would signal a collision and hop back to their original spot. I suppose I could fix this by implementing impulses in the event of a collision instead of just jumping back to the last spot I was in (my implementation kind of sucks).

But while I make my engine more robust, I'm just curious on how most other physics engines handle this case. Do objects that start in the same spot with no movement speed just shoot out from each other in a random direction? Or do they sit there until something happens? Which option is generally the best approach?

share|improve this question
3  
I can't speak to an actual implementation (hence a comment instead of an answer), but in my experience physics engines will typically slowly push the two objects out of each other. For example, if two boxes spawned overlapping each other, they would slowly push away from each other until completely separate. Exactly how this would be implemented is up for consideration. –  ktodisco Dec 17 '12 at 6:04
    
Yeah, I realize this is somewhat of an odd question, since it's asking not so much on how to implement it, but more so how it's normally handled. Thanks for your input! –  C0M37 Dec 17 '12 at 6:31
add comment

1 Answer 1

up vote 4 down vote accepted

I guess this kind of ends up being a non-answer...

I think sometimes it depends on the implementation and the basic approach used for collision detection and resolution (which is like 80% of a rigid body physics engine, I guess). It's funny because I just hit this problem the other day in my own home-grown physics engine and threw an object into NaN space.

I had an object spawn in exactly the same spot as another object and both were the same shape. In this particular case the contact generator made very bad values. I fixed it by picking arbitrary values for the contact (push smaller/lighter object straight up, basically). This was a pretty cut and dry, case, though.

If a chair were to spawn inside of a table then it would be dependent on what contacts were generated whether they flew apart or got stuck. In my case, I'm not using a constraints based system (at least not yet) so the object is just as likely to blow apart as to oscillate and fall asleep. In a penetration+impulse system like the one I use it's pretty easy to see all of the ugly and how it will result. I have no idea how a constraints based system solves this problem or if it even detects it... the constraint seems unreachable to me without some intervention and I have no idea if there is a standard way for those types of engines.

Others will surely have smarter things to say but this was too long for a comment.

share|improve this answer
    
I appreciate your answer. I felt like asking this question as sort of a life raft for others to find should they ever get caught in the same situation. –  C0M37 Dec 18 '12 at 7:32
    
Lol @PSpeed over here also ^^ –  SHiRKiT Dec 23 '12 at 2:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.