0
$\begingroup$

The movement driver already looks in the direction of the empty, and I want it to accelerate towards it as well. I've tried making a function, adding it to driver namespace, but I still get the "invalid python expression" error. How would i do this properly?

import bpy

def driverFunc(object1, object2, acceleration):
    direction = object2 - object1
    delta_x = direction * acceleration
    value = var + delta_x
    return value
bpy.app.driver_namespace['driverFunc'] = driverFunc

screenshot of workspaces

$\endgroup$
2
  • $\begingroup$ It doesn't matter how to fix your problem of calling the function (which requires you to use actual objects as arguments to the function, instead of what you're currently using), as the function itself doesn't work. It was likely generated by chatGPT. Your question would be better if instead you asked for a solution to your actual problem: "How to make one object accelerate towards another?" en.wikipedia.org/wiki/XY_problem $\endgroup$ Sep 17 at 16:56
  • $\begingroup$ i see, I will edit this question then $\endgroup$ Sep 23 at 18:09

0

You must log in to answer this question.

Browse other questions tagged .