Scripted relativeTo and timeline driven relativeToProp

Hey,

Looking for help and / or feedback from Zappar or anyone with experience trying out something similar.

I’m trying to create a reusable ‘transition’ mechanism using relativeTo. I’d need this for smooth transitions between positions that are not known until runtime. This is not very intuitive or easy to follow, but try to bear with me. My logic is the following:

OBJ is the group I want to move with my transition.
MOVER is an empty group I have in the hierarchy.
TIMELINE is a timeline that has (linked) keyframes that are set to alter MOVER.relativeToProp from [1,0] to [0,1].
A is what OBJ is relativeTo before the transition.
B is the target I want OBJ to be relativeTo after the transition.

In my script:

  1. Set MOVER.relativeTo( [A, B] );
  2. Set OBJ.relativeTo( MOVER );
  3. Activate TIMELINE.
  4. On TIMELINE complete -> Set OBJ.relativeTo( B );

The logic only works partly. The OBJ will first transition into the middle of the screen (0,0,0) where MOVER is initially set at in the hierarchy (not to A as I’d expect). After the TIMELINE finishes OBJ will correctly jump to B, but the smooth animated transition I’m after never happens.

To investigate closer, I set an label in the TIMELINE to trigger the debugger. Found out that the relativeTo and relativeToProp values seem to be correct and updating during the transition, but the position of the MOVER does not change.

Is what I’m trying to do possible in Studio? Is this a bug or am I doing something wrong?

Hey Ero,

Hope you’ve been well.

It’s a bit difficult to tell without having a closer look at the functionality in action. Is there any chance you could send a demo over?

At first glance, a possible issue may be the fact that when a group is created, its position is set to (0,0,0) by default.

This means that your two empty groups exist in the same position in space i.e. (0,0,0), and as the node will be transitioning from one group to the other, there will be no visible change in its position.

You could move both the groups’ position in the 3D view, so that they no longer hold the same default position value.

Have you had a chance to try Mark’s suggested method for this functionality, i.e. transitioning the object’s relativeTo property from one empty group to another (e.g. MOVER1 and MOVER2) through the timeline?

If the issue still persists please let me know.

All the best,
Seb

1 Like

It sounds like you want to do the same thing I wanted.

Timelines - start and end

Steve

1 Like

Thank you Sebastian and Steve!

That is exactly what I was trying to implement, but could not get working in my own project. I now found out that the issue was actually somewhere else. I was instantiating this transition symbol whenever I needed it, but had forgotten about attaching it to the scene / pushing it into a existing group.

Everything works as expected now that I fixed my brainfart!

Now I should probably implement pooling for this to avoid filling up the hierarchy with a million transition symbols…

1 Like