Image:
 Author: tatt61880 Group: Japanese Filesize: 15.78 kB Date added: 2010-05-22 Rating: 5 Downloads: 725 Views: 1346 Comments: 2 Ratings: 1 Times favored: 1 Made with: Phun Tags:
|
このシーンでは、密度などの値を変更したときに、画像の表示が変わるようになっています。
密度(density) : X方向の倍率 (デフォルトは1.0)
摩擦(friction) : Y方向の倍率 (デフォルトは1.0)
反発の度合(restitution) : 画像の中心のX座標 (デフォルトは0.5)
引力(attraction) : 画像の中心のY座標 (デフォルトは0.5)
コントローラーの加速度(controller acc.) : 画像の角度 (デフォルトは0)
参考:
onCollide := (e)=>{
Scene.my.scaleX = e.this.density;
Scene.my.scaleY = e.this.friction;
Scene.my.centerX = e.this.restitution;
Scene.my.centerY = e.this.attraction;
Scene.my.angle = e.this.controllerAcc
};
textureMatrix := {[math.cos(Scene.my.angle) / Scene.my.scaleX, math.sin(Scene.my.angle) / Scene.my.scaleX, Scene.my.centerX,
- math.sin(Scene.my.angle) / Scene.my.scaleY, math.cos(Scene.my.angle) / Scene.my.scaleY, Scene.my.centerY,
0.0, 0.0, 1.0]};
textureMatrixの内容は、
[cosθ / 横倍率 , sinθ / 横倍率, 画像中心のX座標,
-sinθ / 縦倍率 , cosθ / 縦倍率, 画像中心のY座標,
0, 0, 1]
(θは画像の角度。単位:ラジアン)
の意味です。 |