@@ -5,12 +5,12 @@ namespace UnityEditor.Rendering.HighDefinition
55{
66 partial class InfluenceVolumeUI
77 {
8- public static void DrawHandles_EditBase ( SerializedInfluenceVolume serialized , Editor owner , Transform transform )
8+ public static void DrawHandles_EditBase ( SerializedInfluenceVolume serialized , Editor owner , Transform transform , SerializedProperty proxyCapturePositionProxySpace )
99 {
1010 switch ( ( InfluenceShape ) serialized . shape . intValue )
1111 {
1212 case InfluenceShape . Box :
13- DrawBoxHandle ( serialized , owner , transform , s_BoxBaseHandle ) ;
13+ DrawBoxHandle ( serialized , owner , transform , s_BoxBaseHandle , proxyCapturePositionProxySpace ) ;
1414 break ;
1515 case InfluenceShape . Sphere :
1616 using ( new Handles . DrawingScope ( Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ) )
@@ -103,13 +103,15 @@ public static void DrawHandles_EditInfluenceNormal(SerializedInfluenceVolume ser
103103 }
104104 }
105105
106- static void DrawBoxHandle ( SerializedInfluenceVolume serialized , Editor owner , Transform transform , HierarchicalBox box )
106+ static void DrawBoxHandle ( SerializedInfluenceVolume serialized , Editor owner , Transform transform , HierarchicalBox box , SerializedProperty proxyCapturePositionProxySpace )
107107 {
108108 using ( new Handles . DrawingScope ( Matrix4x4 . TRS ( Vector3 . zero , transform . rotation , Vector3 . one ) ) )
109109 {
110110 box . center = Quaternion . Inverse ( transform . rotation ) * transform . position ;
111111 box . size = serialized . boxSize . vector3Value ;
112112
113+ Vector3 proxyCapturePositionWS = transform . position + ( transform . rotation * proxyCapturePositionProxySpace . vector3Value ) ;
114+
113115 EditorGUI . BeginChangeCheck ( ) ;
114116 box . DrawHull ( true ) ;
115117 box . DrawHandle ( ) ;
@@ -119,6 +121,8 @@ static void DrawBoxHandle(SerializedInfluenceVolume serialized, Editor owner, Tr
119121 Undo . RecordObject ( transform , "Moving Influence" ) ;
120122 transform . position = newPosition ;
121123
124+ proxyCapturePositionProxySpace . vector3Value = Vector3 . Max ( serialized . boxSize . vector3Value * - 0.5f , Vector3 . Min ( serialized . boxSize . vector3Value * 0.5f , Quaternion . Inverse ( transform . rotation ) * ( proxyCapturePositionWS - transform . position ) ) ) ;
125+
122126 // Clamp blend distances
123127 var blendPositive = serialized . boxBlendDistancePositive . vector3Value ;
124128 var blendNegative = serialized . boxBlendDistanceNegative . vector3Value ;
0 commit comments