IsChildObjectOf() public method

public IsChildObjectOf ( SemanticObject, other ) : bool
other SemanticObject,
return bool
コード例 #1
0
ファイル: OnRelation.cs プロジェクト: dicarlolab/ThreeDWorld
 private List<SemanticObject> PerformTest(SemanticObject obj1, HashSet<SemanticObject> allObservedObjects)
 {
     List<SemanticObject> retList = new List<SemanticObject>();
     foreach(Collision col in obj1.GetActiveCollisions())
     {
         SemanticObjectSimple hitObj = (col.rigidbody == null) ? null : col.rigidbody.GetComponent<SemanticObjectSimple>();
         // Ensures sufficiently low vertical relative velocity to be treated as "at rest"
         if (hitObj != null && Mathf.Abs(col.relativeVelocity.y) < 0.1f && !retList.Contains(hitObj) && !hitObj.IsChildObjectOf(obj1))
         {
             // Check to see if there exists a contact where this object is above the other object
             foreach(ContactPoint pt in col.contacts)
             {
                 if (pt.normal.y > 0.1f)
                 {
                     retList.Add(hitObj);
                     foreach(SemanticObjectComplex parentObj in hitObj.GetParentObjects())
                     {
                         // Add parent objects, unless we are also a child object of that parent
                         if (!retList.Contains(parentObj) && !obj1.IsChildObjectOf(parentObj))
                             retList.Add(parentObj);
                     }
                     break;
                 }
             }
         }
     }
     if (retList.Count > 0)
         return retList;
     return null;
 }
コード例 #2
0
 private List<SemanticObject> PerformTest(SemanticObject obj1, HashSet<SemanticObject> allObservedObjects)
 {
     List<SemanticObject> retList = new List<SemanticObject>();
     foreach(Collision col in obj1.GetActiveCollisions())
     {
         SemanticObjectSimple hitObj = col.rigidbody.GetComponent<SemanticObjectSimple>();
         // Tests that the force in collision goes into target
         RaycastHit targetObj;
         foreach (ContactPoint contact in col.contacts) {
             if (hitObj != null && col.impulse != Vector3.zero && Physics.Raycast(new Ray(contact.point, col.impulse.normalized), out targetObj, 4f) && targetObj.collider == contact.otherCollider && col.impulse.magnitude / Time.fixedDeltaTime > 5f && !retList.Contains(hitObj) && !hitObj.IsChildObjectOf(obj1))
             {
                 retList.Add(hitObj);
                 foreach(SemanticObjectComplex parentObj in hitObj.GetParentObjects())
                     {
                         // Add parent objects, unless we are also a child object of that parent
                         if (!retList.Contains(parentObj) && !obj1.IsChildObjectOf(parentObj))
                             retList.Add(parentObj);
                     }
             }
             break;
         }
     }
     if (retList.Count > 0)
         return retList;
     return null;
 }
コード例 #3
0
 private List<SemanticObject> PerformTest(SemanticObject obj1, HashSet<SemanticObject> allObservedObjects)
 {
     List<SemanticObject> retList = new List<SemanticObject> ();
     foreach (Collision col in obj1.GetActiveCollisions()) {
         SemanticObjectSimple hitObj = col.rigidbody.GetComponent<SemanticObjectSimple> ();
         retList.Add (hitObj);
         foreach (SemanticObjectComplex parentObj in hitObj.GetParentObjects()) {
             // Add parent objects, unless we are also a child object of that parent
             if (!retList.Contains (parentObj) && !obj1.IsChildObjectOf (parentObj))
                 retList.Add (parentObj);
         }
     }
     if (retList.Count > 0) {
         return retList;
     }
     return null;
 }
コード例 #4
0
ファイル: OnRelation.cs プロジェクト: dicarlolab/ThreeDWorld
 public override bool Evaluate(SemanticObject subject, SemanticObject obj)
 {
     return foundObjs.ContainsKey(subject) && foundObjs[subject].Contains(obj) && !subject.IsChildObjectOf(obj);
 }