Vector3 Structure |
Language: |
Describes and manipulates a vector in three-dimensional (3-D) space.
Visual Basic Public Structure Vector3 C# public struct Vector3 C++ public value class Vector3 sealed JScript In JScript, you can use structures, but you cannot define your own.
Set Up a View Matrix
This example demonstrates how to initialize the view transformation matrix, which transforms world coordinates into camera or view space.
In the following C# code example, the vector components of the Vector3 structure form the arguments for the LookAtLH method, which builds a left-handed (LH) look-at matrix. The View transformation matrix is set to be equal to this look-at matrix.
The three input vectors represent the following, respectively:
- The eye point: [0, 3, -5].
- The camera look-at target: the origin [0, 0, 0].
- The current world's up-direction: usually [0, 1, 0].
[C#]
using Microsoft.DirectX.Direct3D; Device device = null; // Create rendering device. // Set up the view matrix. A view matrix can be defined given an eye point, // a point to view, and a direction for which way is up. Here, you set // the eye five units back along the z-axis and up three units, view the // origin, and define "up" to be in the y-direction. device.Transform.View = Microsoft.DirectX.Matrix.LookAtLH( new Vector3(0.0f, 3.0f, -5.0f), new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, 1.0f, 0.0f));
Namespace Microsoft.DirectX Assembly Microsoft.DirectX (microsoft.directx.dll) Strong Name Microsoft.DirectX, Version=1.0.900.0, Culture=neutral, PublicKeyToken=d3231b57b74a1492
Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center