Click or drag to resize
AB4D logo

PlaneVisual3DAlignWithCamera(BaseCamera) Method

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

Namespace: Ab3d.Visuals
Assembly: Ab3d.PowerToys (in Ab3d.PowerToys.dll) Version: 11.1.8864.1045
Syntax
C#
public void AlignWithCamera(
	BaseCamera camera
)

Parameters

camera  BaseCamera
Ab3d.PowerToys camera
Remarks

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

When many PlaneVisual3D 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#
Vector3D planeNormalVector3D, widthVector3D, heightVector3D;
camera.GetCameraPlaneOrientation(out planeNormalVector3D, out widthVector3D, out heightVector3D);

for(int i = 0; i < planes.Count; i++) // Use for instead of foreach to prevent creating Enumerator object
{
    var onePlaneVisual3D = planes[i];

    onePlaneVisual3D.BeginInit();
    onePlaneVisual3D.Normal          = planeNormalVector3D;
    onePlaneVisual3D.HeightDirection = heightVector3D;
    onePlaneVisual3D.EndInit();
}
See Also