How to automatically set an object's location in the center of a Bezier circle?

I have a Bezier circle with four edit points. I would like to have the location of another object automatically change so that it is always in the center of the circle’s geometry.

For example, if I choose a cube object as the “center” object, it will be located here when the circle looks like this:


However, if I stretch out the curve in some way, when I go back to Object mode, I will want the cube’s location to still be in the center of the curve (not necessarily at the curve’s origin point, which may not be the center after you start moving the circle’s handles).

So if I stretch out one of the circle’s handles like this…

…the cube will move with it.

I’m thinking there is probably some modifier or constraint I can put on the cube that will let me do this, but I don’t know which one.

Any ideas?

1 Like

You’ll want 4 Copy Location Constraints, each with 25% influence:

You can (in Edit Mode) press Ctrl + H on each of the vertices to hook them to an empty. Then, when you move those four empties, the circle will change. Set the Copy Locations to those empties, and you get what you’re looking for :slight_smile:

This screenshot shows it better, also I forgot- you need to check Offset on each of those constraints

Thank you, @josephhansen – this is a very clever application of Blender’s features. (I did not know about that Ctrl+H feature to connect vertices to an Empty — very useful!) However, unless I’ve set something up incorrectly, it doesn’t seem to move the object in the middle to the true middle position of the loop.

For example, in this top down view, if I drag the empty on the right side of the screen far over to the right (as indicated by the red arrow that I drew on the screenshot), the cube will move a disproportionate amount over to the right…when the real middle of that area should be approximately where I drew the red square:

Did you check the Offset checkboxes? Are you sure you’re using .25 influence on each? And are you sure that each Constraint has a unique empty? It looks like you’ve got two constraints going to the same empty currently.

I’ve tested it with quite a few different configurations, and if you have those three things correct, it will be in the mathematical center

Yes, I did. Here’s my .blend file:
loop_with_cube_in_middle.blend (2.2 MB)

This method is mathematically correct, and your file is right :slight_smile: it’s more a perception issue- for example, you can move the empties to make a U shape out of the circle, in which case the cube will be outside the curve. However, it will be in the exact center of the four vertices of the circle. The exact center of the vertices doesn’t necessarily visually the center of the curve, because Bézier curve vertices also have handles. There is no simple way to fix this- at that point, you’re essentially re-inventing NURBS the hard way

Ahhh – makes sense. Thanks for the explanation!

1 Like

It’s not mathematically correct. Each offset moves it a quarter of the way to the next point-- the order matters. It isn’t impossible to do it this way, but it shouldn’t be 0.25 weight each time, it should 1.0, 0.5,0.33, 0.25 influence.

But I think the easiest way to get the proper location is to use a mesh with a geometry nodes modifier referencing the curve:

Note that this is the median position of the curve controls, not the center of the circle. Those are two different things. (Copy location *4, with appropriate influences, gets you the median position of the curve controls as well.) The math to find the proper center of the circle is complicated (not easily accessible in Blender, would probably be slow, and is beyond my immediate abilities.) However, we can approximate it by resampling the curve, possibly with extra samples:

1 Like

Thanks, @bandages…I wish I could try your example, but I’m still on Blender 2.93.1. I don’t think 2.93.1 has geometry nodes. Still, this is good to know for future reference!

I should probably back up a bit and explain why I asked the original question on this thread. Maybe there’s a different way of accomplishing what I’m trying to do without setting up an object in the center of a Bezier circle.

I have a rectangle object that I want to move along the circle track. And I want it to always be “in line” with the circle. I’ve done this by putting a Clamp To constraint followed by a Track To constraint on the rectangle object, like in this screenshot:

The Clamp To constraint keeps the object clamped to the circle track. The Track To constraint points the long side of the rectangle toward the cube in the middle of the circle. This works fine when you have not altered the circle’s shape and the cube is truly in the middle of the circle:

However, when you begin stretching the circle, the Track To constraint falls apart. Well, it doesn’t really fall apart – it does exactly what I’m telling it to do. But it doesn’t keep the rectangle oriented so that it’s still in line with the circle. See the section highlighted in red, and how the rectangle is a little crooked:

It’s entirely possible that there’s a different way to accomplish this that doesn’t involve the Track To constraint, but I’m not sure what it would be.

Here’s my .blend file with the rectangle: loop_with_rectangle.blend (2.0 MB)

I think 2.93 has GN, but maybe not attribute statistic node that I used.

For what you want, I would recommend making a non-rendering triangle and giving it a curve modifier, then vertex-parenting your orbiter to that triangle. Without any tilt, with default minimum twist tilt mode, that orbiter should do what you want.

There are some concerns with what you’re doing in weird cases, but if those weird cases don’t come up, you should be fine with the median point of the controls, which you can also get with josephhansen’s way, provided you use the proper influences of 1.0, 0.5, 0.33, 0.25 (1, 1/2, 1/3, 1/4).

For what you want, I would recommend making a non-rendering triangle and giving it a curve modifier, then vertex-parenting your orbiter to that triangle. Without any tilt, with default minimum twist tilt mode, that orbiter should do what you want.

I don’t quite understand what this means.

  1. For the non-rendering triangle, do you mean just a plane with 3 sides that doesn’t get rendered? And does the shape matter?
  2. I’m not clear on how giving the triangle a curve modifier affects things in this situation.
  3. Regarding vertex parenting…is there a specific vertex of the triangle to which the orbiter needs to be attached?

If you could provide a .blend file with this setup (you can use the last file I posted as a starting point if you want), that might clarify things a lot. Thanks!

Sure. Here it is with a deformed circle curve and 120 frames of animation so you can see what it does:

demo.blend (795.3 KB)

Note, parented to a vertex triangle, not to a single vertex.

1 Like

Got it! That works perfectly for what I need.

Thanks, @bandages – and thanks @josephhansen ! I ended up using a combination of both of your answers for the thing that I’m working on (I used the Ctrl+H empties to shape the loop, but the triangle vertex parenting to always keep the outside object oriented correctly).

1 Like