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; }
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; }
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> (); if (!retList.Contains(hitObj)) retList.Add (hitObj); } if (retList.Count > 0) { return retList; } return null; }
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; }