0
$\begingroup$

I'm trying scale an object relative to a moving Empty's coordinate system.

I tried applying the "child of"-constraint to the object and scaling the Empty.

If I tick both the scaling and location options, the scaling happens as desired but when I move the Empty, the object moves along with it. I want the object to stay in place.

If I tick only the scaling option, it will no longer move with the Empty but now the scaling happens relative to the object's local coordinate system. Not what i want.

$\endgroup$
  • 1
    $\begingroup$ If I am correctly understanding your situation, maybe instead of "Child-of" try" Copy Scale". $\endgroup$ – Mentalist Mar 7 '17 at 4:33
  • $\begingroup$ Thanks, tried that but the scaling happened relative to the object's local axis, not relative to the moving axis $\endgroup$ – saldukoo Mar 7 '17 at 10:37
  • $\begingroup$ Could you upload your.blend, or a similar example, to Blend Exchange? Maybe seeing what you're seeing will help me to understand the problem. $\endgroup$ – Mentalist Mar 7 '17 at 11:08
  • $\begingroup$ "scaling an object relative to an axis" is unclear. scaling occurs realtive to a point, maybe pivot, cursor, center... but an axis.. it is infinite. $\endgroup$ – m.ardito Mar 7 '17 at 12:41
  • $\begingroup$ @m.ardito By axis i meant the plural "axes". I edited the post, i hope it is more clear now. $\endgroup$ – saldukoo Mar 7 '17 at 12:58
2
$\begingroup$

You were right with your initial intuition about using a Child-of Constraint.

Here is the somewhat limited method of sucking in an object by scaling an Empty that the Child-of Constraint is using:

Child-of Constraint scaling down an object toward an Empty

The limitation with the method described above is that moving the Empty also relocates the object, even when the "suck-in" effect is not being used.

The solution to this is to keep the Empty scaled down to zero all the time and instead use the Influence Slider to control the effect. The Influence Slider can of course be keyframed for animation.

Child-of Constraint using a zero-scaled Empty, controlled by the Influence Slider

Tip: Enabling "Display: All Object Origins", and also using the Outliner can be helpful for selecting objects in their scaled-to-zero state.

Download the .blend here:

https://blend-exchange.giantcowfilms.com/b/2892/

|improve this answer|||||
$\endgroup$
0
$\begingroup$

I believe that there is a mixture of solutions to this answer, and Mentalist has got this half right.

You can use the child of constraint for the scale, but you will also need something like a driver to move the sphere toward the Empty when scaling happens.

Luckily this sounds like an easy enough driver solution though.

I will have to circle back around to post some detailed images, but here is the simple breakdown:

  1. You will need to set an individual driver on the X, Y, & Z Locations of the Sphere.

  2. You will need to calculate (for each axis - for simplicity here I'll just describe the 'X' Axis) the difference in 'X' between the Empty and the Sphere.

  3. You will need to know the scale factor of the empty (for simplicity just use 'X' for the scale factor).

  4. You now have what you need for the equation.


The total distance is 100% or 1.00 NO MATTER WHAT, while the scale of the Empty is 1.00 as soon as the scale changes it will calculate like this:

distance / 1 = 'Scale-X' / 'unknown'

To solve for the unknown the expression looks like this: 'Scale-X' / distance


This is the basic logic, but you have to go a little further to understand relative positioning:

is the 'X-Loc' of the Sphere <, >, OR = to that of the Empty, and change the return value accordingly.


You know what, I lied, I said this sounded simple, but it is pretty involved.

I should have said doable.


Since Mentalist's Re-Post, it spawned a simplification for the use of a driver in this case. The variation for me, is just to split the ChildOf constraint into two. One for the scale whose influence is always 100%, and another for the location, that will be driven by the actual scale factor. It effectively solved everything that I had mentioned above, but in a much more strait-forward manner.

See below for the setup of both the constraints and the driver. enter image description here

See below for the result of this effort: enter image description here

|improve this answer|||||
$\endgroup$
  • $\begingroup$ I've revised my answer. Give it a look. $\endgroup$ – Mentalist Mar 8 '17 at 11:54
  • $\begingroup$ @Mentalist - It looks really close. I will add the driver solution to a slight variation to that and it will simplify. But by and large, I think you have the right slant on the answer. Good job. --Will Post the modification in my answer 1st. If you like it, I'll append it to yours so we can get one solid answer from your awesome efforts.-- $\endgroup$ – Rick Riggs Mar 8 '17 at 15:30
0
$\begingroup$

So (as I understand it), the question is to do as if the empty was both the origin of the object and its orientation axis.

I think this needs to modify the object geometry dynamically. So I propose the use of Animation Nodes to do that.

enter image description here

The principle is to loop over the object vertices and:

  • Transform it in the world's space
  • Transform it in the empty's space but without considering the scale
  • Scale the vertices
  • Then come back to the world's space and come back to the object's space

Here is the node setting, in two parts: the main loop and what is done to transform each vertex.

Main loop:

enter image description here

1- Get the object geometry (in object's space: so uncheck the 'use world space' option)

2- Create a loop over the vertices

3- Recombine the object geometry with transformed vertices

4- Here I'm using a new object as output as it is easier to tune the node (but that could be done on the initial object too)

5- Move the created object at the original object's position

Vertex transformation:

enter image description here

1- Transform the vertex in world space

2- Transform it to the empty's space but

3- without the scale for now

4- Scale as we are now in the empty's space

5- Come back to world space

6- Then come back to the object's space

7- Output

Of course, you'll need the addon: https://github.com/JacquesLucke/animation_nodes/releases

The blend file

Note: all the matrices which are used in a pipe could be combined once. But that was simpler to explain the calculation not doing that.

|improve this answer|||||
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.