5

Suppose I have an object, that I move from A to B (by pressing the G button) on the XY plane. I want to automatically orient it, so it always faces the direction of the movement. Furthermore, I want it to rotate as if it is a wheel.

Given a linear motion, I want to set the orientation with drivers, so the Y points forward and Z points upward.

As there are no keyframes available, the function that updates the direction and the rotation of the "wheel" must be invoked regularly to capture the current and the previous positions and make the needed updates.

Initial scene: Initial scene

The wheel has been dragged/is being dragged: The wheel has been dragged/is being dragged

Can it be achieved ONLY with drivers?

  • 2
    Deducting the orientation just from the starting orientation and the positional offset is not possible. You would have to have a function describing the motion or approximate it in small steps. Or do you only want this for a single axis (X), like your equation suggests. – Leander Dec 21 '19 at 10:59
  • @Leander yes, only around one axis (sphere's local X axis). For that the sphere must also automatically align its Y axis with the direction of the movement. The problem is calculating the positional offset in a driver. –  Dec 21 '19 at 11:14
  • I have edited your question, because in this case "drag around the XY-Plane" would be incorrect. Please correct it if i misunderstood – Leander Dec 21 '19 at 11:18
  • @Leander you have probably misunderstood it. The sphere is moved in a plane and reorients itself to face the direction of the movement, so that it can be rotated around its X axis like it is rolling. –  Dec 21 '19 at 11:25
  • Yes, I misunderstood, please correct the question. Maybe others can benefit from an even clearer phrasing as well. What data would the drive have to deduce the direction? Two keyframes? A single position (+ the world origin? ... – Leander Dec 21 '19 at 11:27
  • @Leander as far as I understand, all I need is two points: current position and previous position. To align the sphere we simply compute the difference, normalize it and make the sphere's forward vector equal the normalized difference. The position offset is simply the norm of the difference. –  Dec 21 '19 at 11:45
  • I am terribly sorry, but I have just massacred your question, believing that it is now clearer. Please forgive me if this is not the case. You (or I) can roll it back in the revision history. I believe introducing a ball (with many degrees of freedom) only confuses the reader. I also tried to add the concept of an upward and forward axis. As a potential answerer, it is still not clear where the driver can get the two position from. Is it keyframes? Is is frames? Is is a user interaction. – Leander Dec 21 '19 at 11:52
  • @Leander yes, ball was i pretty bad idea. I believe a wheel/cylinder is better. Where to get the positions to compute the deltaPosition is exactly my question. The object is dragged in the viewport without any keyframes. I could write a script that would bake the rotations in each frame but I want it to happen in real time. –  Dec 21 '19 at 11:56
  • 1
    This is a hack to store the previous position. (Edit) Whops, the dependency graph rework from 2.8 broke it. – Leander Dec 21 '19 at 13:50

0 Answers0