Esempio n. 1
0
 internal override bool HitTest(AABBCollider other, out Hit hit)
 {
     return(CollisionDetectionHelper.CheckIntersect(
                other.GetWorldspaceRect(), this.GetWorldspaceRect(),
                out hit
                ));
 }
Esempio n. 2
0
 /// <summary>
 /// Abstract class for the object to be able to load in its own model.
 /// </summary>
 /// <param name="m">Content loader</param>
 public virtual void loadModel()
 {
     if (modelName != null)
     {
         model = contentLoader.Load <Model>(modelName);
         CollisionDetectionHelper.setModelData(model);
         CollisionDetectionHelper.ConstructMeshPartBoundingSpherees(model);
         CollisionDetectionHelper.ConstructObjectLevelBoundingSphere(model);
         CollisionDetectionHelper.ConstructMeshLevelBoundingSphere(model);
     }
 }
Esempio n. 3
0
    public void CheckIntersect(Rect mover, Rect stator, Hit?expectedHit)
    {
        Hit  hit;
        bool didHit = CollisionDetectionHelper.CheckIntersect(mover, stator, out hit);

        if (!expectedHit.HasValue)
        {
            Assert.IsFalse(didHit);
            return;
        }

        Assert.That(didHit);
        Assert.That(hit.normal, Is.EqualTo(expectedHit.Value.normal));
        Assert.That(hit.delta, Is.EqualTo(expectedHit.Value.delta));
        Assert.That(hit.position, Is.EqualTo(expectedHit.Value.position));
    }