trois icon indicating copy to clipboard operation
trois copied to clipboard

can I use troisjs load external model like use threejs ? and how? tks

Open hijack-621 opened this issue 3 years ago • 3 comments

hijack-621 avatar Mar 28 '22 07:03 hijack-621

Do you mean loading a 3d model file (gltf or else) ?

klevron avatar Mar 28 '22 20:03 klevron

It is possible to load external. I just look into while ago in how to do as the src code is easy to understand once look more of the examples.

Text2D.js or Text2D.mjs

import { defineComponent } from 'vue';
import { Object3D } from 'troisjs';
import { Text } from 'troika-three-text';
export default defineComponent({
  name: 'Text2D',
  extends: Object3D,
  setup() {
    const text2D = new Text();
    text2D.text = 'Hello world!'
    text2D.fontSize = 0.2
    //text2D.position.z = -2
    text2D.color = 0x9966FF
    return {
      text2D,
      //group: new Group(),
      //text2D: new Text(),
    }
  },
  created() {
    //this.initObject3D(this.group)
    this.initObject3D(this.text2D)
  },
  //__hmrId: 'Group',
  __hmrId: 'text2D',
})

Be sure to follow some vue defineComponent for use in extend class for object3D. But I didn't see the guide about it.

Lightnet avatar Mar 29 '22 04:03 Lightnet

yes。 that i mean

---- 回复的原邮件 ---- | 发件人 | Kevin @.> | | 日期 | 2022年03月29日 04:21 | | 收件人 | @.> | | 抄送至 | @.@.> | | 主题 | Re: [troisjs/trois] can I use troisjs load external model like use threejs ? and how? tks (Issue #131) |

Do you mean loading a 3d model file (gltf or else) ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

hijack-621 avatar Mar 29 '22 10:03 hijack-621