'Hug Surface' constraint?

Spaddlewit
Posts: 28
Joined: Fri Sep 04, 2009 8:23 pm

'Hug Surface' constraint?

Post by Spaddlewit »

I have a btSphere Rigid Body moving along a btBvhTriangleMesh. I'd like for the sphere to be constrained to the surface of the mesh depending on certain conditions. Is there a way I can mimic this in bullet?

Image
xexuxjy
Posts: 225
Joined: Wed Jan 07, 2009 11:43 am
Location: London

Re: 'Hug Surface' constraint?

Post by xexuxjy »

It sounds as though you want to control the object as a kinematic object, rather than let bullet look after it directly. First option that came to my mind (and I'm sure there are better ways) would be to alter the gravity of the object when it's on a downwards slope (use a ray-test to find the contact point). of course if the object is travelling fast, even with high gravity it could leave the slope for a while.
Spaddlewit
Posts: 28
Joined: Fri Sep 04, 2009 8:23 pm

Re: 'Hug Surface' constraint?

Post by Spaddlewit »

Yep, that's exactly what I was doing, but was having some odd issues with it -- turns out it's some floating point rounding errors that I had to clamp.