File tree Expand file tree Collapse file tree 3 files changed +31
-34
lines changed Expand file tree Collapse file tree 3 files changed +31
-34
lines changed Original file line number Diff line number Diff line change 11import { Mesh } from "@babylonjs/core/Meshes/mesh" ;
2+ import { Vector3 } from "@babylonjs/core/Maths/math.vector" ;
23
34import { IScript , visibleAsNumber } from "babylonjs-editor-tools" ;
45
56export default class SceneComponent implements IScript {
6- @visibleAsNumber ( "Speed" , {
7- min : 0 ,
8- max : 0.1 ,
9- } )
7+ @visibleAsNumber ( "Speed" , {
8+ min : 0 ,
9+ max : 0.1 ,
10+ } )
1011 private _speed : number = 0.04 ;
1112
12- public constructor ( public mesh : Mesh ) { }
13+ public constructor ( public mesh : Mesh ) { }
1314
14- public onStart ( ) : void {
15+ public onStart ( ) : void { }
1516
16- }
17-
18- public onUpdate ( ) : void {
19- this . mesh . rotation . y += this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ;
20- }
17+ public onUpdate ( ) : void {
18+ this . mesh . rotate ( Vector3 . UpReadOnly , this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ) ;
19+ }
2120}
Original file line number Diff line number Diff line change 11import { Mesh } from "@babylonjs/core/Meshes/mesh" ;
2+ import { Vector3 } from "@babylonjs/core/Maths/math.vector" ;
23
34import { IScript , visibleAsNumber } from "babylonjs-editor-tools" ;
45
56export default class SceneComponent implements IScript {
6- @visibleAsNumber ( "Speed" , {
7- min : 0 ,
8- max : 0.1 ,
9- } )
7+ @visibleAsNumber ( "Speed" , {
8+ min : 0 ,
9+ max : 0.1 ,
10+ } )
1011 private _speed : number = 0.04 ;
1112
12- public constructor ( public mesh : Mesh ) { }
13+ public constructor ( public mesh : Mesh ) { }
1314
14- public onStart ( ) : void {
15+ public onStart ( ) : void { }
1516
16- }
17-
18- public onUpdate ( ) : void {
19- this . mesh . rotation . y += this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ;
20- }
17+ public onUpdate ( ) : void {
18+ this . mesh . rotate ( Vector3 . UpReadOnly , this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ) ;
19+ }
2120}
Original file line number Diff line number Diff line change 11import { Mesh } from "@babylonjs/core/Meshes/mesh" ;
2+ import { Vector3 } from "@babylonjs/core/Maths/math.vector" ;
23
34import { IScript , visibleAsNumber } from "babylonjs-editor-tools" ;
45
56export default class SceneComponent implements IScript {
6- @visibleAsNumber ( "Speed" , {
7- min : 0 ,
8- max : 0.1 ,
9- } )
7+ @visibleAsNumber ( "Speed" , {
8+ min : 0 ,
9+ max : 0.1 ,
10+ } )
1011 private _speed : number = 0.04 ;
1112
12- public constructor ( public mesh : Mesh ) { }
13+ public constructor ( public mesh : Mesh ) { }
1314
14- public onStart ( ) : void {
15+ public onStart ( ) : void { }
1516
16- }
17-
18- public onUpdate ( ) : void {
19- this . mesh . rotation . y += this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ;
20- }
21- }
17+ public onUpdate ( ) : void {
18+ this . mesh . rotate ( Vector3 . UpReadOnly , this . _speed * this . mesh . getScene ( ) . getAnimationRatio ( ) ) ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments