POV-Ray : Newsgroups : povray.binaries.images : Piles of things (with Bullet Physics Playground) : Re: Piles of things (with Bullet Physics Playground) Server Time
30 Jul 2024 12:29:52 EDT (-0400)
  Re: Piles of things (with Bullet Physics Playground)  
From: Robert McGregor
Date: 18 Sep 2012 08:00:01
Message: <web.505862222fe15fc5f7aa22b40@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
> It seems to be as I thought. Simulating with only collision objects
> works well. This means that mesh objects need to be as close in shape to
> the collision objects as possible.

Maybe you could use combined collision shapes like Sam did with the nails? After
seeing that little trick I dug into Bullet a bit more and found how to do it
directly. While I was poking around I also found that the ragdoll is really just
a simple collection of capsules and joint constraints:

class RagDoll
{
   enum
   {
      BODYPART_PELVIS = 0,
      BODYPART_SPINE,
      BODYPART_HEAD,

      BODYPART_LEFT_UPPER_LEG,
      BODYPART_LEFT_LOWER_LEG,

      BODYPART_RIGHT_UPPER_LEG,
      BODYPART_RIGHT_LOWER_LEG,

      BODYPART_LEFT_UPPER_ARM,
      BODYPART_LEFT_LOWER_ARM,

      BODYPART_RIGHT_UPPER_ARM,
      BODYPART_RIGHT_LOWER_ARM,

      BODYPART_COUNT
   };

   enum
   {
      JOINT_PELVIS_SPINE = 0,
      JOINT_SPINE_HEAD,

      JOINT_LEFT_HIP,
      JOINT_LEFT_KNEE,

      JOINT_RIGHT_HIP,
      JOINT_RIGHT_KNEE,

      JOINT_LEFT_SHOULDER,
      JOINT_LEFT_ELBOW,

      JOINT_RIGHT_SHOULDER,
      JOINT_RIGHT_ELBOW,

      JOINT_COUNT
   };

   ...
   ...

   m_shapes[BODYPART_PELVIS] = new btCapsuleShape(
      btScalar(0.15), btScalar(0.20));
   m_shapes[BODYPART_SPINE] = new btCapsuleShape(
      btScalar(0.15), btScalar(0.28));
   m_shapes[BODYPART_HEAD] = new btCapsuleShape(
      btScalar(0.10), btScalar(0.05));
   m_shapes[BODYPART_LEFT_UPPER_LEG] = new btCapsuleShape(
      btScalar(0.07), btScalar(0.45));
   m_shapes[BODYPART_LEFT_LOWER_LEG] = new btCapsuleShape(
      btScalar(0.05), btScalar(0.37));
   m_shapes[BODYPART_RIGHT_UPPER_LEG] = new btCapsuleShape(
      btScalar(0.07), btScalar(0.45));
   m_shapes[BODYPART_RIGHT_LOWER_LEG] = new btCapsuleShape(
      btScalar(0.05), btScalar(0.37));
   m_shapes[BODYPART_LEFT_UPPER_ARM] = new btCapsuleShape(
      btScalar(0.05), btScalar(0.33));
   m_shapes[BODYPART_LEFT_LOWER_ARM] = new btCapsuleShape(
      btScalar(0.04), btScalar(0.25));
   m_shapes[BODYPART_RIGHT_UPPER_ARM] = new btCapsuleShape(
      btScalar(0.05), btScalar(0.33));
   m_shapes[BODYPART_RIGHT_LOWER_ARM] = new btCapsuleShape(
      btScalar(0.04), btScalar(0.25));

   ...
   ...
}

Another thought, maybe try making the collision shapes smaller for the floating
meshes?

-------------------------------------------------
www.McGregorFineArt.com


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.