MatrixTests CreateLookAt Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Datatypes
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void CreateLookAt()
Examples

[Test]
public void CreateLookAt()
{
    var createdLookAt = Matrix.CreateLookAt(Vector3D.UnitZ, Vector3D.UnitX, Vector3D.UnitY);
    var expected = new Matrix(0.7071f, 0.0f, -0.7071f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
        0.7071f, -0.0f, 0.7071f, 0.0f, -0.7071f, 0.0f, -0.7071f, 1.0f);
    Assert.IsTrue(createdLookAt.IsNearlyEqual(expected));
}
[Test]
public void CreateLookAtFiveMetersDistance()
{
    var createdLookAt = Matrix.CreateLookAt(new Vector3D(0.0f, 0.0f, 5.0f), Vector3D.Zero,
        Vector3D.UnitY);
    var expected = new Matrix(
        1.0f, 0.0f, 0.0f, 0.0f,
        0.0f, 1.0f, 0.0f, 0.0f,
        0.0f, 0.0f, 1.0f, 0.0f, 
        0.0f, 0.0f, -5.0f, 1.0f);
    Assert.IsTrue(createdLookAt.IsNearlyEqual(expected));
}
See Also