Skip to content

Replacing meshes/assets in .glb avatars on react-native #1396

Answered by donmccurdy
Osama217 asked this question in Q&A
Discussion options

You must be logged in to vote

If you install the alpha release of v4 ...

yarn add @gltf-transform/core@next @gltf-transform/extensions@next @gltf-transform/functions@next

... there's a new copyToDocument function that can help considerably with this. To apply the changes described you'll need to do something like:

import { NodeIO } from "@gltf-transform/core";
import { ALL_EXTENSIONS } from "@gltf-transform/extensions";
import { copyToDocument, dedup, prune, unpartition } from "@gltf-transform/functions";

// Input.
const io = new NodeIO().registerExtensions(ALL_EXTENSIONS);
const avatarDocument = await io.read("./avatar1.glb");
const capDocument = await io.read("./Avaturn-asset-cap.glb");

// Transfer cap into avatar…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Osama217
Comment options

Answer selected by Osama217
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants