- Home /
Using AnimationClip.SetCurve on child object.
If i have 2 cubes, the first is the parent of the second in the hierarchy. How do I aim the relativePath parameter at the child cube?
Here is what I have tried, the code is in a script attached to the parent.
private void Test()
{
AnimationClip clip = new AnimationClip();
AnimationCurve curve = new AnimationCurve.Linear(0, 1, 2, 3);
clip.SetCurve("", typeof(Transform), "localPosition.x", curve);
clip.SetCurve("Child", typeof(Transform), "localEulerAngles.x", curve);
animation.AddClip(clip, "test");
animation.Play("test");
}
Obviously, this doesn't work. The reference(link), does not really shed any light on how to use the relativePath parameter.
Comment