move multiple objects vertically based on x object proximity

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  06 June 2013
move multiple objects vertically based on x object proximity

Hi all,
so I have this project where I have near 2000 pin shaped object that reside on a certain z position which I need to move in a wave like form on z axis. Think of it as a pin box but pins should move up by rows until they all get raised up. Any suggestions on how to do that in a simple way as linking and moving 2000 object is somewhat troublesome.
I was thinking of something like a script that move an array of objects on z axis based on another object proximity.
Any suggestions are much appreciated.
  06 June 2013
Something like this?

If you were going to do this based on rows, you could have the entire row be a single mesh.


Also, you could use this script. Not the exact same thing but it sounds ballpark to what you want.

Create a dummy and then copy some boxes. Select the boxes. This code will animate the boxes based on their relative position to the Dummy. You can move the dummy around then rerun the script.

           	fn compareFN v1 v2 =
				local myD = getnodebyname ("Dummy001")
				local d = (distance v1 myD)-(distance v2 myD)
				case of
				(d < 0.): -1
				(d > 0.): 1
				default: 0

thearr = for o in selection collect o
qsort thearr compareFN 
            For b = 1 to thearr.count do
                with animate on

		  at time t thearr[b].height = thearr[b].height
                  at time t thearr[b].height += 10
  06 June 2013
The youtube tutorial is more of an object being stretched on z-axis which is not the case in my project, and my pins are randomly but tightly aligned so they form a certain image.
All I need is some sort of a script that would simply evaluate the distance (x or y) between each pin (array assignment) and the dummy object. Once the distance is under lets say 1, the pin(s) affected start moving upwards until it reaches zPosition.y in a predefined #of frames regardless of the dummy's position afterwards.
I wish I had the scripting bliss...

This how I see it work on the hope someone would translate this into a script:

Define objectArray elements ["pin001", ..., "pin2000"] ; if there's an easy way to list them.
Define objectArray elements max zPos= 0 ; as original position is at -zPos value (<0)
Define dummyVolume (BoundingBox) as dummy could be of thin but wide volume
Evaluate objectArray elements zPos.
Evaluate Current Frame
Define Dur: 15Frames
Define objectArray travelSpeed: Final zPos - Current zPos / Dur
Evaluate distance (x or y) between each Pin and the dummyVolume:
if Distance > 1 : null
else if Distance <= 1 : trigger movement on the affected Pin by travelSpeed/Frame until it reaches Final zPos and remove from evaluation.
If all Pins have a zPos value of 0 break script.


Last edited by MadLogic325 : 06 June 2013 at 09:13 AM.
  06 June 2013
Quote: Define dummyVolume (BoundingBox) as dummy could be of thin but wide volume

Why the bounding box? Do you care about the volume of the dummy or just it's position (pivot point)?

As far as I can tell either one of the solutions above should give you what you need.
  06 June 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:19 AM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.