CCamilo
CCamilo

Reputation: 887

Change Object parent in Three.js using JSON file

I'm using same technique explained in this example

I defined a JSON file that contains all objects, geometries and animations. However, I couldn't find the way to specify in the animation a change of object's parent. Also, by looking at the documentation of the Three.js library I don't see any ObjectKeyframeTrack which would be nice to set an object's parent.

My questions is referring the JSON file format, not using the API, to do this. I know there is a similar question (Change Object parent in Three.js?) but is not what I am looking for.

In any case, other approaches are welcome as well.

Upvotes: 0

Views: 54

Answers (1)

Don McCurdy
Don McCurdy

Reputation: 12000

This was solved in the forum but i'll crosspost the answer here: the three.js animation system does not provide a way to serialize changes in the scene graph as part of a JSON file. JSON keyframe animation can affect properties of objects like position, rotation, scale, and color. To change the parent of an object, you would need to use custom JS at the appropriate time in the animation playback.

Upvotes: 2

Related Questions