2
$\begingroup$

I am trying to make a mesh plane scale around a curve circle (a clock face) using a driver to scale the mesh based on the x and z position of an empty. IE: as I move the empty in a circular motion around a clock face, I want the mesh to scale around the clock by following the position of the empty in both the x and z axis. Also, I would like to be able to limit the mesh scaling in some way if possible?

Is there a way to do this? Any help would be greatly appreciated.

Here is a link to the .blend file I have so far:

Many thanks in advance.

$\endgroup$
2
  • $\begingroup$ You need to translate "scale around the clock", because it doesn't make any sense. Ideally, show some images of what you want. $\endgroup$ Commented Sep 13 at 20:08
  • 1
    $\begingroup$ Hi Daniel. Thankyou for your comment, I will provide images that help to express my intentions going forward. $\endgroup$ Commented Sep 15 at 7:41

2 Answers 2

1
$\begingroup$

You said position in the X and Z axes, but from your file, I assume you meant the X and Y axes.

In the driver for your Plane's X axis, temporarily replace the expression with 1.0. (You can do this simply by clicking on the purple driver field and entering 1.0.)

enter image description here

In Edit mode, scale your plane along the X axis so it's exactly 1m long:

enter image description here

and switch back to Object mode.

Edit your driver for the plane's X location. Add a "y_loc" variable for the Empty's Y location, and replace the expression with:

atan2(x_loc,y_loc)/2/pi % 1 

like so:

enter image description here

The length of the plane will now follow the X/Y location of the empty:

enter image description here

This works because the function atan2(x,y) calculates the angle in radians of the direction vector from the origin to the point (x,y). By dividing by 2*pi, you get a number from -0.5 to 0.5, with 0 being the 12 o'clock position. The "%" mod operator remaps the -0.5 to 0 range to 0.5 to 1, so the final result is a number from 0 at the 12 o'clock position all the way up to 1 at the "just before" 12 o'clock position. This scales the plane from 0 to 1m, which gets translates to "none" to "all" of the curve by the Curve modifier.

$\endgroup$
4
  • 1
    $\begingroup$ Hi K. A. Buhr. Thankyou very much for your help, it worked perfectly! I have a lot to learn regarding driver expressions, but I can see how useful, and powerful, they can be from the example that you kindly provided. Thanks again, it's much appreciated. Have a nice day! $\endgroup$ Commented Sep 15 at 7:34
  • 1
    $\begingroup$ Hi there. Sorry, but I forgot to mention how much I appreciated the detailed explanation of the mathematics in the scripted expression, brilliant! Thanks again. $\endgroup$ Commented Sep 15 at 9:47
  • $\begingroup$ @JayT: it would be nice if you could at least upvote the answer from which you learnt something and/or even better: click on the checkmark left to the answer as "right answer" $\endgroup$ Commented Sep 15 at 11:02
  • 2
    $\begingroup$ Hi Chris. Just to clear, I'm new to stack exchange, and this was my first post. I tried to upvote the answers immediately after those answers were provided, but I got a message from stack exchange saying: "Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote." Also, because of the stack exchange message, I presumed that I would not be able to click the checkmark either (which is my fault). Hope that helps to clarify. Thanks. $\endgroup$ Commented Sep 16 at 7:44
2
$\begingroup$

Although you didn't ask for Geometry Node solutions, I'd like to share this as it is quite good use case for Geometry Node based rigging:

enter image description here

enter image description here

This setup calculates the angle between Empty position and Y axis, then drives Arcs sweep angle with it. The basic idea is very simple, but it gets a bit complicated because of the differences on how Arc and handles angles compared to Angles calculated from the Empty. We have to “flip” the position of empty and remap the angles.

enter image description here

Arc Curve is used to create the Strip with Mesh to Curve. Angle also drives the Arc Resolution. So density keeps constant while length changes.

enter image description here

Set Curve Normal fixes issue with alignment of end points. Because the first and last point doesn't have neighbors, their tangents are calculated wrongly if we assume that the arc is an isolated part of a full circle.So we need to calculate our own normals for the curve. enter image description here

$\endgroup$
3
  • $\begingroup$ Hi khellstr. Thankyou very much for providing your solution. I never even thought of using Geometry Nodes! I especially like the flexibility of using different nodes to achieve quick results, like being able to adjust the resolution/radius/start angle and scale by simply changing the values within the respective nodes, it's VERY intuitive. That's brilliant! Thankyou once again, I hope you have a nice day! $\endgroup$ Commented Sep 15 at 8:11
  • 1
    $\begingroup$ @JayT: it would be nice if you could at least upvote the answer from which you learnt something or even better: click on the checkmark left to the answer as "right answer" $\endgroup$ Commented Sep 15 at 11:03
  • 1
    $\begingroup$ Hi Chris. Just to clear, I'm new to stack exchange and this was my first post. I tried to upvote the answer immediately after the answer was posted, but I got a message from stack exchange saying: "Hang on, you can't upvote just yet. You'll need to complete a few actions and gain 15 reputation points before being able to upvote." Hope that helps to clarify. Thanks. $\endgroup$ Commented Sep 16 at 7:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.