/// <summary>
        /// Adds the child shape.
        /// </summary>
        /// <param name="localTransform">The local transform.</param>
        /// <param name="shape">The shape.</param>
        public void AddChildShape(float4x4 localTransform, IMultiSphereShapeImp shape)
        {
            var btPositions = new Vector3[shape.SphereCount];
            var btRadi      = new float[shape.SphereCount];

            for (int i = 0; i < shape.SphereCount; i++)
            {
                var pos = Translator.Float3ToBtVector3(shape.GetSpherePosition(i));
                btPositions[i] = pos;
                btRadi[i]      = shape.GetSphereRadius(i);
            }
            var btChildShape     = new MultiSphereShape(btPositions, btRadi);
            var btLocalTransform = Translator.Float4X4ToBtMatrix(localTransform);

            BtCompoundShape.AddChildShape(btLocalTransform, btChildShape);
        }
Exemple #2
0
        /// <summary>
        /// Returns the spheres position.
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        public float3 GetSpherePosition(int index)
        {
            var retval = _multiSphereShapeImp.GetSpherePosition(index);

            return(retval);
        }
 public void AddChildShape(float4x4 localTransform, IMultiSphereShapeImp shape)
 {
     var btPositions = new Vector3[shape.SphereCount];
     var btRadi = new float[shape.SphereCount];
     for (int i = 0; i < shape.SphereCount; i++)
     {
         var pos = Translater.Float3ToBtVector3(shape.GetSpherePosition(i));
         btPositions[i] = pos;
         btRadi[i] = shape.GetSphereRadius(i);
     }
     var btChildShape = new MultiSphereShape(btPositions, btRadi);
     var btLocalTransform = Translater.Float4X4ToBtMatrix(localTransform);
     BtCompoundShape.AddChildShape(btLocalTransform, btChildShape);
 }