void OnCollisionEnter(Collision collision) { cloth.DetachFromCollider(col); cloth.AttachToCollider(col, false, true); cloth.stretchingStiffness = stiffness; rigidbody.constraints = RigidbodyConstraints.FreezePosition; }
void OnColl(Vector3 point, Collider t) { AttachedTo = t.transform.GetComponentInParrent <Wall>(); if (AttachedTo != null && AttachedTo.attachRope) { offs = AttachedTo.transform.InverseTransformPoint(pos); attached = true; Cloth.DetachFromCollider(pl.RopeColl); Cloth.AttachToCollider(pl.RopeColl, false, true); rigidbody.isKinematic = true; } if (!attached) { EnableRope(false); } var p = t.transform.GetComponentInParrent <PhysAnim>(); if (p != null) { if (p.PlayOnRopeHit && networkView.isMine) { p.RPCPlay(); } } }
static int DetachFromCollider(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 2); InteractiveCloth obj = LuaScriptMgr.GetNetObject <InteractiveCloth>(L, 1); Collider arg0 = LuaScriptMgr.GetNetObject <Collider>(L, 2); obj.DetachFromCollider(arg0); return(0); }