/// <summary>
 /// Apply rigid body properties
 /// </summary>
 /// <param name="rigidBody">Rigid body</param>
 /// <param name="properties">Properties</param>
 public static void ApplyProperties(this RigidBody rigidBody, ref RigidBodyProperties properties)
 {
     if (properties.IsActive == false)
     {
         rigidBody.ActivationState = ActivationState.DisableSimulation;
     }
     if (properties.HasContactResponse == false)
     {
         rigidBody.CollisionFlags |= CollisionFlags.NoContactResponse;
     }
     if (properties.DebugViewEnabled == false)
     {
         rigidBody.CollisionFlags = CollisionFlags.DisableVisualizeObject;
     }
 }
        public static Tuple <RigidBody, int> CreateRigidBody(this IRigidBodyContainer world, CollisionShape collisionShape, ref RigidBodyPose initialPose, ref RigidBodyProperties bodyProperties, ref BulletSharp.Vector3 localInertia, float mass, string customString)
        {
            DefaultMotionState motionState = new DefaultMotionState((BulletSharp.Matrix)initialPose);

            RigidBodyConstructionInfo constructionInfo = new RigidBodyConstructionInfo(mass, motionState, collisionShape, localInertia);

            constructionInfo.ApplyRigidBodyProperties(ref bodyProperties);

            RigidBody rigidBody = new RigidBody(constructionInfo);

            rigidBody.CollisionFlags = CollisionFlags.None;
            rigidBody.ApplyProperties(ref bodyProperties);

            BodyCustomData customData = new BodyCustomData(world.GetNewRigidBodyId());

            customData.Custom = customString;

            rigidBody.UserObject = customData;

            world.Register(rigidBody);
            return(new Tuple <RigidBody, int>(rigidBody, customData.Id));
        }
 public static void ApplyRigidBodyProperties(this RigidBodyConstructionInfo constructionInfo, ref RigidBodyProperties properties)
 {
     constructionInfo.Friction        = properties.Friction;
     constructionInfo.Restitution     = properties.Restitution;
     constructionInfo.RollingFriction = properties.RollingFriction;
 }