/// <summary>
    /// Slightly modified BPairCachingGhostObject's _BuildCollisionObject method, sets local variables.
    /// Done on Initialization.
    /// </summary>
    internal override bool _BuildCollisionObject()
    {
        #region Remove old collision object.
        BPhysicsWorld world = BPhysicsWorld.Get();
        if (m_collisionObject != null)
        {
            if (isInWorld && world != null)
            {
                isInWorld = false;
                world.RemoveCollisionObject(this);
            }
        }
        #endregion

        #region Warnings and Errors
        //Friendly note
        if (collisionShape.transform.localScale != UnityEngine.Vector3.one)
        {
            Debug.LogWarning("The local scale on this collision shape is not one. Bullet physics does not support scaling on a rigid body world transform. Instead alter the dimensions of the CollisionShape. " + name, this);
        }

        if (collisionShape == null)
        {
            Debug.LogError("There was no collision shape set. " + name, this);
            return(false);
        }
        if (!(collisionShape.GetCollisionShape() is ConvexShape))
        {
            Debug.LogError("The CollisionShape on this character controller is not a convex shape. " + name, this);
            return(false);
        }
        #endregion

        #region Init PairCachingGhostObject and ConvexShape
        m_collisionObject = new PairCachingGhostObject();

        m_collisionShape = collisionShape;
        m_collisionObject.CollisionShape = m_collisionShape.GetCollisionShape();
        m_collisionObject.CollisionFlags = m_collisionFlags;

        BulletSharp.Math.Matrix     worldTrans;
        BulletSharp.Math.Quaternion q = transform.rotation.ToBullet();
        BulletSharp.Math.Matrix.RotationQuaternion(ref q, out worldTrans);
        worldTrans.Origin = transform.position.ToBullet();
        m_collisionObject.WorldTransform = worldTrans;
        m_collisionObject.UserObject     = this;
        #endregion

        ghostObject = (PairCachingGhostObject)m_collisionObject;
        convexShape = (ConvexShape)m_collisionShape.GetCollisionShape();

        world.AddAction(this);

        return(true);
    }