# Object not following path defined in curve editor

I’ve set up points to oscillate between +2.5 and -2.5: I defined keyframes for z-location at 0, 2.5, 0, -2.5, 0. I tweaked the tweening cardinal spline tension such that the path in the curve editor matches a sine wave (tension values: 1, -0.4, 1, -0.4, 1).
However, the points actually follow a linear path between the defined keyframe values. Is this a bug, or do I misunderstand the tweening options?

oscillation.3dm (1.9 MB)

Hi,

Bongo seems to be approximating a sin wave with your keyframes, but this is an imperfect solution. I didn’t dig too deep but it doesn’t look like it’s being phase shifted correctly. For something like this you should be using Bongos expression system which allow you to set keyframes based on some mathematical formula.
The docs are here:

And here’s an example:
Phase Shift.3dm (160.0 KB)
The expression ends up being 4 * sin(t / 100 * 2 * pi + n * pi / 8). Multiplying by four gives the sine wave an amplitude of 4 so the effect is more obvious, t is the current tick which I divide by 100, the total animation length, to get it in the range of 0-1.0. From there I multiply it by 2*PI which is the period of the sin function. Then I add n * pi / 8. This is the phase shift. N is that points number along the line. So the first point is 0, the second is 1, and so on.

1 Like

Thank you very much! I had not thought of using expressions, which is a very nice and flexible solution!

I did not see the option Expression tab at first. Only after reading the docs again I noticed the following:
“Controlling position with expressions or using Position parameters for arguments is only possible when 3-dimensional tweening is disabled.”

Yes, I’m sorry, I forgot to mention that in my solution. 3D tweening needs disabled. This was actually the issue with your original file as well. Disabling it makes your points oscillate correctly. I still think expressions are a better solution though.
oscillation_no_3d_tweening.3dm (2.0 MB)

You did find an issue but it’s already been reported here. Custom tweening needs to be disabled for 3D parameters.

Thanks!
Within expressions, is it possible to refer to an object’s property without specifying its own name? Something like #SELF.POSITION X#? Then I can copy the object many times, and the phase would update based on the object’s x-postition. This way, it is not needed to manually adjust the object’s name in every object.

Unfortunately not, but I’ve added it as a feature request for Bongo 3 here.