Click or drag to resize
Ab4d.SharpEngine logo

PlaneModelNodeAlignWithCamera Method

AlignWithCamera method aligns the PlaneModelNode to be oriented so that it faces the specified camera.

Namespace: Ab4d.SharpEngine.SceneNodes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 4.1.9680+a1b1e43de1ad9a7e35472c33948d688d7b40ef79
Syntax
C#
public void AlignWithCamera(
	ICamera camera
)

Parameters

camera  ICamera
camera
Remarks

AlignWithCamera method aligns the PlaneModelNode to be oriented so that it faces the specified camera.

When many PlaneModelNode objects need to be aligned with the camera, then it is better to use the following code to align all the planes (this way the GetCameraPlaneOrientation method is called only once):

C#
camera.GetCameraPlaneOrientation(out var planeNormalVector, out _, out var heightVector);

for(int i = 0; i < planes.Count; i++) // Use for instead of foreach to prevent creating Enumerator object
{
    var onePlaneModelNode = planes[i];
    onePlaneModelNode.Normal          = planeNormalVector;
    onePlaneModelNode.HeightDirection = heightVector;
}
See Also