# How can I simulate a mechanical lever in which pushing one object will cause the second object to move around its origin?

I am trying to figure out how to use Blender to simulate a real world application. I'm wondering if Blender will allow me to create a response to a stimulus or whether I have to mathematically calculate the response and then (somehow) program this into the objects? I have uploaded the test model to blend exchange . The green block is constrained to only rotate around the origin on the Z plane. The red bar is constrained to movel only along the Y axis. I would like to move the red bar and see the green bar rotate as a consequence of the movement of the red bar. Is this possible or do I have to do all of the trigonometry? If I have to do the trig then how do I configure blender to use the calculation / formula?

The image shows the starting position

Thanks in anticipation

• can u pls tell us what u did with your rigid body setup? why are your masses 0? (which makes no sense in a rigid body world). Why is the mass 0 if i create a new rigid body in your blend file? normally it should be 1kg.... Jun 30, 2022 at 16:58
• Hi Chris, I haven't set up any rigid body parameters (out of ignorance). For my simulation I am only interested in visualising how one object will move when stimulated by another. If setting up masses is a requirement then I will need to do that. These will be small metal parts weighing a few grams each and while I will be happy to experiment with different mass values, from my current level of understanding I do not see how the mass relates to the position. I kind of see that if I succeed in moving the green bar then as it is currently massless and frictionless it would simply spin for ever Jun 30, 2022 at 17:10
• ok, then just download my example file and check it out. if you want ;) if you have questions, just ask. i just was curious because of your blender file...i had to make a new one ;) Jun 30, 2022 at 17:11

## 2 Answers

I hope you want to do something like this:

This could be easily achieved with a hinge.

So start with a new blend file (i have no idea what happened to your file...even gravity was changed...)

Make a plane, give it a rigid body passive.

Create the two boxes, then select the plane, shift-select the green bar and choose Object->rigid body -> connect.

then select the newly created empty and change type to hinge.

give the red object rigid body passive and check "animated". Animate the movement of the red bar with keyframes.

Additionally you can give the green bar a generic spring connection like this:

example file:

result:

Of course you can change the stiffness of your spring as you want.

• Thanks Chris, This model does what I expect in the absence of friction or some other force to constrain the green bar. I'll take a look at your model and see if I can get it to work as I intend. In reality the green bar will be spring loaded so when I apply a force to the red bar to move it along the Y axis the green bar will remain in contact with the red bar and will return the red bar to its original position when the red bar force is removed. I realise that I have a lot to learn. Jun 30, 2022 at 17:24
• ah...ok...i will update my answer...give me a minute Jun 30, 2022 at 17:31
• i updated my answer Jun 30, 2022 at 17:41
• Thanks again, I'm about to grab something to eat and then I'll have a play with the settings later this evening. I've already learned a lot, the important point for me has been to understand which controls to use and where to find them. Jun 30, 2022 at 18:00
• I've spent a bit of time getting close to your model but with a couple of issues (how to set the actual point of rotation in the hinge and how the springs work) but I think I've got enough to move one or two steps forward. I'll dig in to the Blender manual a bit more and research around the areas of connections and rigid bodies. Thanks again Jul 1, 2022 at 10:04

If I didn't completely misunderstand you, you can solve this with a Transform Constraint.

Here you can map the Y-location of an object to the Z-rotation of another object.

• Ah, OK, I just see that I really misunderstood the question. ...I'll leave the answer anyway, maybe it will help someone. Jun 30, 2022 at 17:10
• GREAT. This is exactly what I want to achieve. would you be kind enough to upload your model and point out what you did that's different from my original settings please. Do you make the red bar move as a consequence of the green bar rotating or the other way around? Jun 30, 2022 at 17:18
• @argyrg I actually just used your file, and added an additional constraints modifier to the object named "pivot". You can see in the screenshot how I configured it. PS: The red bar drives the green bar (location -> rotation). Jun 30, 2022 at 19:12