# Drivers and direction vector

I want to use drivers to animate a sphere rolling around the floor. The setup I have is a sphere with the following custom properties:

circumference - driver with a value of x scale * pi

distance - driver that tracks the distance between the sphere and an empty located at world origin

time - self explanatory

xvec - drives the x component of the axis angle since I can’t seem to use the component directly in a driver

yvec - same as xvec only for the y component

I also have drivers on the W component (I’m not sure what the technical terminology is, as I normally use Euler XYZ but it gives strange results when trying to rotate on two axes) that’s distance/circumference*(360*(pi/180)), drivers on the y and z scale to lock it to the x scale, and drivers on all three location channels, with z having a value of z scale/2 to constrain it to the floor when it’s scaled.

So far most things work correctly. If I change the x scale to 5 y and z scale with it and it rests on the floor. The circumference also updates correctly, assuming you set the dimensions of the sphere to 1 and apply scaling.

If I set one of the rotational vectors to 0 and the other to 1 it will rotate properly when I move it on the correct axis. With both vectors at 1, -1, or a combination of 1 and -1 if I keyframe it with an equal x and y location it seems to rotate properly.

The problem is with the x and y location drivers. I want to be able to animate the time property and have the direction based on the vectors. It works with static vectors, but if I want to have it move at a 45 degree angle relative to the global origin then move only on the x or y axis after several frames then keyframing the appropriate vector will move it back to that axis’ origin, or if I animate the vector from 0 to 1 it will move too fast until it gets to 1.

What I’m trying to do is get it to where it will use the x and y vectors to determine the direction (from -1 to 1), but not alter the present location if the vector changes to 0 or speed up if it changes to 1. For example, if the x location is 10 and I drop the x vector down to 0 the sphere should stay at 10 x and keep moving on the y axis instead of returning to 0.

I’ve already tried timevec, which gives me the results described above. I haven’t found any way to increment something by a variable, such as t += vec, followed by timet. I’ve tried every function and constant I know and nothing seems to fix it.

Any ideas? Preferably explained in a way that someone who took two tries to get through basic algebra over 10 years ago could understand.

Can you post an example?