Plane |
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):
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; }