0
$\begingroup$

I want to use a driver to open and close a hatch by rotating it on its y axis. So when I move the empty on the z axis the hatch should rotate on the y axis. I locked the empty on a min and max z value because there is something else driven by it. When i move the empty through the full range the other animation is complete but the hatch didn't rotate far enough. I know i can make it rotate further by writing var*2 or more in the driver editor but i don't want to adjust the multiplication of the var until the rotation is correct because it takes too long for multiple hatches. Is there another way to basically set the rotation that is reached when the driver is fully "extended"?the driver/empty controls the landing gear and the hatches, the empty can only be moved .465m on the z axis until the landing gear is inside the box

$\endgroup$
1
  • 1
    $\begingroup$ tbh this is not a blender question - but a math question. You have 2 points (x1,y1) and (x2,y2) and you want to calculate the y = mx + n function for that. (rot_max-rot_min)/(zmax-zmin)*(z-zmin)+rot_min in your case $\endgroup$
    – Chris
    Mar 21, 2023 at 14:23

1 Answer 1

2
$\begingroup$

Nice, I see you are working on a Millennium Falcon model ;) If you don't want to go for the maths behind this, instead of using drivers you could use a Transform constraint on the hatch with the empty as Target.

You can choose which transformations you want to map from one object to the other - in your case Location to Rotation, and you can use different Min/Max values. Also you can decide whether the global or local coordinates are relevant on both objects. This will be necessary since I suspect the empty and the hatches will be parented to a spaceship that can move, so the global positions will be variable.

In the following example I have an empty that can only move from +1 on the Z axis to +3. I created three sets of hatches with three different behaviours:

  1. rotates 0° to 120° from Z +1 to +2
  2. rotates 0° to 120° from Z +1 to +3
  3. rotates 0° to 90° from Z +2 to +3

different hatches

As you can see, 1. and 2. both rotate 120°, but the first hatch is opened quicker than the second. The 3. starts to open later and rotates just 90° (by the way, that's for the left hatch doors, the right doors have the corresponding negative angles). //EDIT: No negative angles, see last paragraph.

These are the settings of the left doors. The Target is the empty, both Target and Owner are set to Local Space so that when you parent everything to another object, they can move around with it and still work correctly.

Under Map From I chose Location and the Z Min and Max values for the range in which I want the hatch to open. The Map To is set to Rotation, important now is to set the Y Source Axis (because I want to rotate them on Y) to Z, because I want the Z value of the empty to drive the rotation. As Min and Max I set the range for the opening angles.

constraint settings

This is an example to show that it works even when parented to another object:

parented constraints

Of course there are much more settings for the Transform constraint. And just after finishing all this I realized you don't have to put Transform constraints on all doors. In my file I just have them on the left doors, the right doors have Copy Rotation constraints with inverted Y axis. This way you only have to adjust the angles for one of the doors per hatch.

copy rotation constraint

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .