## Position based dynamics collisions

Please don't post Bullet support questions here, use the above forums instead.
Enigma
Posts: 3
Joined: Sun Aug 24, 2008 12:14 am

### Position based dynamics collisions

Hi there,

I'm currently implementing a version of the Position Based Dynamics paper by Mueller. However, I'm having some problems with the collision constraint they're using ( C = q*n - h ), mainly that I'm apparently somewhat mixed up in my hand and just can't manage to find the correct gradients for the function.

For the single vertex it's pretty obvious that the gradient is the normal of the triangles, however the gradients of the triangle vertices are not so clear. I tried calculating them but somehow I always mess up somewhere (i.e. it doesn't match numerically calculated gradients I'm using for testing).

It would be great if someone could help me out on this.

Nathanael
Posts: 78
Joined: Mon Nov 13, 2006 1:44 am

### Re: Position based dynamics collisions

You could try to express the position in triangle as barycentric coordinate let say: P0*u+P1*v+P2*(1-u-v)
[ -N*u , -N*v , -N*(1-u-v) ]
(based on C=(q-(P0 u + P1 v + P2 (1-u-v))).N )

Hope its work and help,
Nathanael.

Enigma
Posts: 3
Joined: Sun Aug 24, 2008 12:14 am

### Re: Position based dynamics collisions

D'oh, I knew this would end up being something absolutely easy. Thank you so much, works just like it's supposed to

che
Posts: 4
Joined: Mon Nov 17, 2008 2:55 pm

### Re: Position based dynamics collisions

Is thi paper of Muller (position based dynamics) implemented somewhere in the bullet source code ?