Class LightAnchor
Represents camera-space light controls around a virtual pivot point.
Inherited Members
Namespace: UnityEngine
Assembly: Unity.RenderPipelines.Core.Runtime.dll
Syntax
[AddComponentMenu("Rendering/Light Anchor")]
[ExecuteInEditMode]
[DisallowMultipleComponent]
[CoreRPHelpURL("View-Lighting-Tool", "com.unity.render-pipelines.core")]
public class LightAnchor : MonoBehaviour
Properties
anchorPosition
The position of the light's anchor point.
Declaration
public Vector3 anchorPosition { get; }
Property Value
Type | Description |
---|---|
Vector3 |
anchorPositionOffset
Offset relative to the position of the anchor position override transform in object space.
Declaration
public Vector3 anchorPositionOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
anchorPositionOverride
Overrides the pivot of used to compute the light position. This is useful to track an existing object in the scene. The transform of the light will be automatically updated by the Update() method of the LightAnchor.
Declaration
public Transform anchorPositionOverride { get; set; }
Property Value
Type | Description |
---|---|
Transform |
distance
The distance from the light's anchor point.
Declaration
public float distance { get; set; }
Property Value
Type | Description |
---|---|
float |
frameSpace
Indicates whether the up vector should be in world or camera space.
Declaration
public LightAnchor.UpDirection frameSpace { get; set; }
Property Value
Type | Description |
---|---|
LightAnchor.UpDirection |
pitch
The pitch relative to the horizon or camera depending on value of m_Space.
Declaration
public float pitch { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
The range is -180 through 180 inclusive. Values between 0 and 180 are below the camera, and values between 0 and -180 are above the camera.
roll
The camera-relative roll.
Declaration
public float roll { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
The range is -180 through 180 inclusive. Values between 0 and 180 are to the right of the camera, and values between 0 and -180 are to the left of the camera.
yaw
The camera-relative yaw.
Declaration
public float yaw { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
The range is -180 through 180 inclusive. Values between 0 and 180 are to the right of the camera, and values between 0 and -180 to the left.
Methods
NormalizeAngleDegree(float)
Normalizes the input angle to be in the range of -180 and 180.
Declaration
public static float NormalizeAngleDegree(float angle)
Parameters
Type | Name | Description |
---|---|---|
float | angle | Raw input angle or rotation. |
Returns
Type | Description |
---|---|
float | Returns the angle of rotation between -180 and 180. |
SynchronizeOnTransform(Camera)
Updates Yaw, Pitch, Roll, and Distance based on the Transform.
Declaration
public void SynchronizeOnTransform(Camera camera)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The Camera to which light values are relative. |
UpdateTransform(Camera, Vector3)
Updates the light's transform with respect to a given camera and anchor point
Declaration
public void UpdateTransform(Camera camera, Vector3 anchor)
Parameters
Type | Name | Description |
---|---|---|
Camera | camera | The camera to which values are relative. |
Vector3 | anchor | The anchor position. |