;FISHMOVE.K3D : "Select and Move" ;by Sanford Kennedy, CIS 73201,1374 ;See article about this script in 3D ARTIST magazine issue #23, page 19. ;This script lets you select up to 1,000 objects and move them to Dummy01 ;anywhere in your scene. It asks you for the starting frame of the move ;and the ending frame of the move. The animation can be of any length. ;Used in Sanford Kennedy's "Octopus's Garden" to move a school of fish. ; ;INITIALIZATION - This section sets up memory space for variables. ; Dim PickSomeObjects$(999,40) :'sets up memory to hold up to 1000 :'object names of up to 40 characters DefPosition MovingObject :'sets up position variable for Fish DefPosition CenterObject :'sets up position variable for Dummy01 NumFrames :'total number of frames in animation ; ;CONFIGURE - This section creates dialog boxes that ask for user input. ; GetKeyByNumber "Dummy01", 0, CenterObject :'find location of Dummy01 PickObjects "Please pick Moving objects :", PickSomeObjects$, 1 ObjectsCaught = RC :'selection dialog box If ObjectsCaught = 0 then End MoveStart = int(MoveStart) :'start dialog box Input "Set start frame - must be less than end:", MoveStart MoveEnd = int(MoveEnd) :'end dialog box Input "Set end frame - must be less than total:",MoveEnd ; ;PROCESS - This section has two counters that go through the list of ;objects and set the starting and ending position keys. ; SetSegment 0, Time :'sets the active frames segment ;First For/Nest loop finds start positions For Counter = 0 to ObjectsCaught -1 :'the 1st object is #0, not #1 InterpolateKey PickSomeObjects$(Counter), MoveStart, MovingObject MovingObject.time = MoveStart - 1 If MoveStart <= 0 then MovingObject.time = 0 CreateKey PickSomeObjects$(Counter), MovingObject :'create start keys Next Counter ;Second For/Next loop assigns end positions For Counter = 0 to ObjectsCaught -1 GetKeyByNumber PickSomeObjects$(Counter), MoveStart, MovingObject MovingObject.x = CenterObject.x MovingObject.y = CenterObject.y :'makes end positions equal MovingObject.z = CenterObject.z :'to Dummy01 position MovingObject.time = MoveEnd CreateKey PickSomeObjects$(Counter), MovingObject :'create end keys Next Counter ;End of Script