1
$\begingroup$

I am currently modelling a complicated gearbox and I am using drivers to model the relations between the parts. There are multiple gears turning in different ratios and to each gear, a few parts are attached. I used drivers to couple the rotation ratios of the gears and then parented all parts that turn with the gears to those respective gears. The rotational axis of all gears are in the y-direction. This all works completely and looks great. However, if I rotate the model around the z axis for 90 degrees, all rotations glitch at a certain point and jump for a few degrees. The really weird thing is, if I rotate the model 90 degrees in 5 degree increments at a time, everything is back to normal again and the model works in every direction. Is this some kind of weird glitch? Is this a known bug? Is there anything I can do to fix it?

Minimal example

$\endgroup$
5
  • $\begingroup$ When 90 degrees flags an issue in drivers it is almost always caused by gimbal lock Simple example blender.stackexchange.com/questions/164765/… $\endgroup$ – batFINGER Mar 10 at 14:28
  • $\begingroup$ I also thought about gimbal lock but the issue occurs as well if I rotate only by 45° and it does not occur at 90° if I use 18*5° individual rotations :O $\endgroup$ – Carl Philipp Mar 10 at 14:31
  • $\begingroup$ Is there any reasonable way to explain this? best would be a video... Thing is, although there are multiple drivers depending on each other, the first relation already shows this problem. I already re-parented everything to be as simple as possible. $\endgroup$ – Carl Philipp Mar 10 at 14:47
  • $\begingroup$ Can I upload a minimal example blender file somewhere here? $\endgroup$ – Carl Philipp Mar 10 at 15:13
  • $\begingroup$ Let us continue this discussion in chat. $\endgroup$ – Carl Philipp Mar 10 at 15:18
1
$\begingroup$

Bad choice of WORLD space.

To test Added a simple driver #frame - 1 to the drive shaft to get it spinning.

As suspected the issues are caused by a

i) Using rotation transform driver type, with WORLD_SPACE

enter image description here Parented the whole set up to an empty, rotating the world space of the parent changes the world space of the children and causes irregular results.

Recommend either. Lesser

Change all to local space. Here is a script to select all parts and will change transform type driver targets to local space.

import bpy
context = bpy.context

for ob in context.selected_objects:
    if not ob.animation_data:
        continue
    for d in ob.animation_data.drivers:
        for v in d.driver.variables:
            if v.type == 'TRANSFORMS':
                for t in v.targets:
                    t.transform_space = 'LOCAL_SPACE'

After which

enter image description here Note The outer gear is driven by the stationary hidden object, No idea why it worked at all.

However as mentioned in comments Eulers are prone to gimbal lock and since it's local could simply use the property. (Also makes sure the rotation is not restricted to (-180. 180) which can be the case in constraints and can be difficult to diagnose if not aware)

Finally, would contend that all gears could be driven directly by the rotation of the drive shaft. For most cases a custom property "drive" could be added to the gear and the driver could be

self["ratio"] * drive

where drive is a single property variable pointing to the shaft Y rotation, or in the case shown (enable Use Self in the driver)

self["ratio"} * (frame - 1)

since I set that as the drive shaft Y rotation.

$\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.