0
\$\begingroup\$

Long story short, I had to roll my own physics engine for my game because box2D and similar packages weren't compatible with the portal based layouts in my game.

So I've made a constraint system and a collision system, which both work somewhat well. But i can't figure out how to combine them, because the constraints are sort of integrated across a time step, while a collision happens at a distinct moment in time, after which the velocity changes drastically, unlike the minor adjustments made in constraints.

How are these two systems integrated with each other?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

In most constraint-based physics systems I have seen the contacts are implemented as a constraint, which constrains the two bodies from penetrating the contact. Box2d is no exception. Each degree of a constraint is solved aspart of the jacobian matrix, although some details about ordering of constraints does exist to improve stability. I would study the box2d source as well as Bullet to see what a contact becomes (a constraint) and how that fits into the solver.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .