Mapbox-gl-js: How to add Gltf Model ,which can play animation

Created on 17 Sep 2019  ·  3Comments  ·  Source: mapbox/mapbox-gl-js

How to add Gltf Model ,which can play animation.The example is static model, how to play animation?Thanks very much.

Most helpful comment

Hi @tangjuncheng1986, thanks for using Mapbox!

As you can see from the Add a 3D model example, you can use THREE.js to render a glTF model in a custom Mapbox layer. There's also @peterqliu's threebox library which makes the integration even easier.

As far as I understand, THREE and its GLTFLoader handle animation out of the box, so there shouldn't be much difference between importing a static vs. animated glTF model using THREE and adding it to the map either by hand as in the example or using threebox.

Hope that helps!

All 3 comments

Hi @tangjuncheng1986, thanks for using Mapbox!

As you can see from the Add a 3D model example, you can use THREE.js to render a glTF model in a custom Mapbox layer. There's also @peterqliu's threebox library which makes the integration even easier.

As far as I understand, THREE and its GLTFLoader handle animation out of the box, so there shouldn't be much difference between importing a static vs. animated glTF model using THREE and adding it to the map either by hand as in the example or using threebox.

Hope that helps!

The example at https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/ is just to demonstrate how to use ThreeJS with Mapbox GL JS via the Custom Layers API. If you're using ThreeJS then maybe this example will help show how you could do animations?

Thank you very much.I will try it.

------------------ 原始邮件 ------------------
发件人: "Andrew Harvey"notifications@github.com;
发送时间: 2019年9月18日(星期三) 上午8:40
收件人: "mapbox/mapbox-gl-js"mapbox-gl-js@noreply.github.com;
抄送: "梦醒"125521596@qq.com;"Mention"mention@noreply.github.com;
主题: Re: [mapbox/mapbox-gl-js] How to add Gltf Model ,which can playanimation (#8766)

The example at https://docs.mapbox.com/mapbox-gl-js/example/add-3d-model/ is just to demonstrate how to use ThreeJS with Mapbox GL JS via the Custom Layers API. If you're using ThreeJS then maybe this example will help show how you could do animations?

https://threejs.org/examples/#webgl_animation_keyframes

https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_keyframes.html


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aendrew picture aendrew  ·  3Comments

BernhardRode picture BernhardRode  ·  3Comments

rasagy picture rasagy  ·  3Comments

mollymerp picture mollymerp  ·  3Comments

muesliq picture muesliq  ·  3Comments