示例#1
0
 public ABSpringJoint(ABRigidBody _a, ABRigidBody _b)
 {
     BodyA      = _a;
     BodyB      = _b;
     Stiffness  = 20000.0f;
     RestLength = 1.0f;
     Dampen     = 200.0f;
 }
        /// <summary>
        /// Adds a rigidbody to the world if it doesn't already exist.
        /// </summary>
        /// <param name="_body"></param>
        public void AddRigidBody(ABRigidBody _body)
        {
            if (RigidBodies.Contains(_body))
            {
                Debug.LogWarning("Can't add duplicate rigid body!");
                return;
            }

            RigidBodies.Add(_body);
        }
        /// <summary>
        /// Removes a rigidbody from the world if it exists.
        /// </summary>
        /// <param name="_body"></param>
        public void RemoveBody(ABRigidBody _body)
        {
            if (RigidBodies.Contains(_body))
            {
                RigidBodies.Remove(_body);
                return;
            }

            Debug.LogWarning("Attempted to remove a body from world that didn't exist.");
        }