Move multiple selected objects by mouse position.

Hi, This script (without the group code) works for a single selected object. I like it to work the same way with multiple objects. The way underneath doesn’t. I’d like some corrections if possible. Thank you

group selection name:"tempgroup"

tool objectPlacer numPoints:1
(
on freeMove do $tempgroup.pos = [gridPoint.x, gridPoint.y, $tempgroup.pos.z]
)
if selection.count == 1 do startTool objectPlacer

ungroup $tempgroup

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jahman's picture

.

you can do it without grouping

(
	tool selectionMover numPoints:1
	(	
		local lastoffset
		local prevCenter = selection.center
 
		on freeMove do
		(
			if lastoffset != undefined do selection.center -= lastoffset
			offset = (gridPoint - prevCenter) * [1,1,0]
			selection.center += offset
			lastoffset = offset
		)
	)
 
	if selection.count != 0 do startTool selectionMover
)
remykonings's picture

*

Thank you Jahman, I appreciate it :)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.