public void RemoveJoint(PlayerLegJoint joint) { for (int i = 0; i < _jointList.Count; i++) { if (_jointList[i].joint == joint) { _jointList.RemoveAt(i); break; } } }
public void AddJoint(PlayerLegJoint joint) { if (joint == null) { return; } Vector2 pos = transform.position; var dir = joint.body.position - pos; var q = Quaternion.Inverse(transform.rotation); dir = q * dir; _jointList.Add(new JointParam(dir, joint)); }
public JointParam(Vector2 dir, PlayerLegJoint joint) { this.dir = dir; this.joint = joint; }