@@ -5,12 +5,12 @@ namespace UnityEditor.Rendering.HighDefinition
5
5
{
6
6
partial class InfluenceVolumeUI
7
7
{
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 )
9
9
{
10
10
switch ( ( InfluenceShape ) serialized . shape . intValue )
11
11
{
12
12
case InfluenceShape . Box :
13
- DrawBoxHandle ( serialized , owner , transform , s_BoxBaseHandle ) ;
13
+ DrawBoxHandle ( serialized , owner , transform , s_BoxBaseHandle , proxyCapturePositionProxySpace ) ;
14
14
break ;
15
15
case InfluenceShape . Sphere :
16
16
using ( new Handles . DrawingScope ( Matrix4x4 . TRS ( transform . position , transform . rotation , Vector3 . one ) ) )
@@ -103,13 +103,15 @@ public static void DrawHandles_EditInfluenceNormal(SerializedInfluenceVolume ser
103
103
}
104
104
}
105
105
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 )
107
107
{
108
108
using ( new Handles . DrawingScope ( Matrix4x4 . TRS ( Vector3 . zero , transform . rotation , Vector3 . one ) ) )
109
109
{
110
110
box . center = Quaternion . Inverse ( transform . rotation ) * transform . position ;
111
111
box . size = serialized . boxSize . vector3Value ;
112
112
113
+ Vector3 proxyCapturePositionWS = transform . position + ( transform . rotation * proxyCapturePositionProxySpace . vector3Value ) ;
114
+
113
115
EditorGUI . BeginChangeCheck ( ) ;
114
116
box . DrawHull ( true ) ;
115
117
box . DrawHandle ( ) ;
@@ -119,6 +121,8 @@ static void DrawBoxHandle(SerializedInfluenceVolume serialized, Editor owner, Tr
119
121
Undo . RecordObject ( transform , "Moving Influence" ) ;
120
122
transform . position = newPosition ;
121
123
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
+
122
126
// Clamp blend distances
123
127
var blendPositive = serialized . boxBlendDistancePositive . vector3Value ;
124
128
var blendNegative = serialized . boxBlendDistanceNegative . vector3Value ;
0 commit comments