This possibly has a pretty simple solution, but right now it's driving me nuts.
The basic idea is this:
1. A field of similar objects, all randomly placed.
2. Clicking an object centers the object on the screen by moving the whole field, and zooms in on the field by scaling the clicked object to a predetermined size.
3. Clicking another object repeats the process.
In the attached file, everything works fine - but only step 1 and 2. Step 3 just doesn't quite make it, but is almost there. My calculation isn't quite right and clip doesn't center properly.
I have stripped out all of the irrelevant code from this, and just left the core of the concept intact. Hopefully someone smarter than me can see where it's broken!
I have isolated the problem, but am still having trouble with it. I need to be able to calculate the distance the field should move as the clip changes scale. This works the first time, when the clip is scaled to 100%, but I can't work out how to make it work when the clip is scaled to something other than 100% (i.e. when it has already moved and scaled before).
I wonder if you guys can be of any help - I face a similar problem but I need my spheres to rotate around a central point and bring the clicked sphere to the front of the screen.
Basically my set of spheres need to maintain their tetrahedron formation - please see attached, I dont think I'm far off now but jut need that final push! Any help would be more than appreciated - got a client waiting to see this working on Monday!!!