@@ -257,33 +257,33 @@ public void ProcessInput(ActionMapInput input, ConsumeControlDelegate consumeCon
257
257
258
258
foreach ( var kvp in directSelection )
259
259
{
260
- var rayOrigin = kvp . Key ;
261
- var selection = kvp . Value ;
262
- var hoveredObject = selection . gameObject ;
260
+ var directRayOrigin = kvp . Key ;
261
+ var directSelectionData = kvp . Value ;
262
+ var directHoveredObject = directSelectionData . gameObject ;
263
263
264
- var selectionCandidate = this . GetSelectionCandidate ( hoveredObject , true ) ;
264
+ var selectionCandidate = this . GetSelectionCandidate ( directHoveredObject , true ) ;
265
265
266
266
// Can't select this object (it might be locked or static)
267
- if ( hoveredObject && ! selectionCandidate )
267
+ if ( directHoveredObject && ! selectionCandidate )
268
268
continue ;
269
269
270
270
if ( selectionCandidate )
271
- hoveredObject = selectionCandidate ;
271
+ directHoveredObject = selectionCandidate ;
272
272
273
- if ( ! this . CanGrabObject ( hoveredObject , rayOrigin ) )
273
+ if ( ! this . CanGrabObject ( directHoveredObject , directRayOrigin ) )
274
274
continue ;
275
275
276
- var directSelectInput = ( DirectSelectInput ) selection . input ;
276
+ var directSelectInput = ( DirectSelectInput ) directSelectionData . input ;
277
277
if ( directSelectInput . select . wasJustPressed )
278
278
{
279
- this . ClearSnappingState ( rayOrigin ) ;
279
+ this . ClearSnappingState ( directRayOrigin ) ;
280
280
281
281
if ( objectGrabbed != null )
282
- objectGrabbed ( hoveredObject ) ;
282
+ objectGrabbed ( directHoveredObject ) ;
283
283
284
284
consumeControl ( directSelectInput . select ) ;
285
285
286
- var selectedNode = selection . node ;
286
+ var selectedNode = directSelectionData . node ;
287
287
288
288
// Check if the other hand is already grabbing for two-handed scale
289
289
foreach ( var grabData in m_GrabData )
@@ -292,7 +292,7 @@ public void ProcessInput(ActionMapInput input, ConsumeControlDelegate consumeCon
292
292
if ( otherNode != selectedNode )
293
293
{
294
294
var otherData = grabData . Value ;
295
- m_ScaleStartDistance = ( rayOrigin . position - otherData . rayOrigin . position ) . magnitude ;
295
+ m_ScaleStartDistance = ( directRayOrigin . position - otherData . rayOrigin . position ) . magnitude ;
296
296
m_ScaleFirstNode = otherNode ;
297
297
for ( int i = 0 ; i < otherData . grabbedObjects . Length ; i ++ )
298
298
{
@@ -302,10 +302,12 @@ public void ProcessInput(ActionMapInput input, ConsumeControlDelegate consumeCon
302
302
}
303
303
}
304
304
305
- m_GrabData [ selectedNode ] = new GrabData ( rayOrigin , directSelectInput , Selection . transforms , this ) ;
305
+ var grabbedObjects = new HashSet < Transform > { directHoveredObject . transform } ;
306
+ grabbedObjects . UnionWith ( Selection . transforms ) ;
307
+ m_GrabData [ selectedNode ] = new GrabData ( directRayOrigin , directSelectInput , grabbedObjects . ToArray ( ) , this ) ;
306
308
307
- this . HideDefaultRay ( rayOrigin , true ) ; // This will also unhighlight the object
308
- this . LockRay ( rayOrigin , this ) ;
309
+ this . HideDefaultRay ( directRayOrigin , true ) ; // This will also unhighlight the object
310
+ this . LockRay ( directRayOrigin , this ) ;
309
311
310
312
// Wait a frame since OnSelectionChanged is called at the end of the frame, and will set m_DirectSelected to false
311
313
EditorApplication . delayCall += ( ) =>
0 commit comments