Esempio n. 1
0
        private void ConnectCandidate()
        {
            if (_nearJointPoint == null || _senderJointPoint == null)
            {
                return;
            }

            if (_nearJointPoint.JointBehaviour._rigidbody.isKinematic != _senderJointPoint.JointBehaviour._rigidbody.isKinematic)
            {
                Debug.Log($"Can not connect joints with different kinematics");
                return;
            }

            Debug.Log($"Joint invoke! {_senderJointPoint}");
            TransformToJoint(_nearJointPoint.JointBehaviour.gameObject, _nearJointPoint, _senderJointPoint);
            _senderJointPoint.Connect(_nearJointPoint.JointBehaviour.gameObject, _nearJointPoint);

            if (AutoLock)
            {
                _senderJointPoint.Lock();
            }

            OnConnect?.Invoke();
            _nearJointPoint.JointBehaviour.OnConnect?.Invoke();
        }
Esempio n. 2
0
        public void ConnectToJointPoint(JointPoint myPoint, JointPoint otherPoint)
        {
            TransformToJoint(gameObject, myPoint, otherPoint);
            otherPoint.Connect(gameObject, myPoint);
            OnConnect?.Invoke();
            otherPoint.JointBehaviour.OnConnect?.Invoke();

            if (AutoLock)
            {
                otherPoint.Lock();
            }
        }