11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

THREE.js で継承しる

Last updated at Posted at 2013-01-24

なんか既に常識かとおもいきやぐぐってもあまり情報が出て来なかったので。

three.js で mesh とかを継承したクラスを作る時
いつもの CoffeeScript なノリで

faild.coffee
class HogeMesh extends THREE.Mesh
	constructor:(geo, mat)->
		super(geo, mat)

とかくとうまいこと継承されません。
three.js な何かを Coffee で継承させたい場合

super.coffee
class HogeMesh extends THREE.Mesh
	constructor:(geo, mat)->
		THREE.Mesh.call(@, geo, material)

とする必要があるようです。
というかこの場合多分 extends THREE.Mesh が要らないような気もしますが気持ちの問題で残してます。

11
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?