-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path19-Mesh Pivot.sb
More file actions
62 lines (48 loc) · 1.39 KB
/
19-Mesh Pivot.sb
File metadata and controls
62 lines (48 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
;Babylon.sbi - Mesh Pivot
EnableExplicit
IncludeFile "babylon/babylon.sbi"
Enumeration
#mf
#mfRender
EndEnumeration
Global Scene, Box, BoxMat
Declare LoadGame()
Declare RenderGame()
UseModule BJS
OpenWindow(#mf, 0, 0, 800, 600, "Mesh Pivot", #PB_Window_ScreenCentered)
CanvasGadget(#mfRender, 0, 0, 800, 600, #PB_Canvas_Transparent)
InitEngine(@LoadGame(), #mfRender)
Procedure LoadGame()
Scene = CreateScene()
If Scene
;Camera & Light
CreateCamera("camera", 0, 7, 25, #BJS_ArcRotate)
CreateLight("my light", 0, 50, 0, 0.8)
;Ground
CreateGround("ground", 20, 20)
;Red Box
Box = CreateBox("box", 2, 2, 2)
BoxMat = CreateMaterial("box color")
SetMaterialColor(BoxMat, #BJS_Diffuse, RGB(255, 0, 0))
SetMeshMaterial(Box, BoxMat)
MoveMesh(Box, 0, 1, 0)
;Change the coordinates of the rotation point
SetMeshPivot(Box, 1, 0, 1)
RenderLoop(@RenderGame())
EndIf
EndProcedure
Procedure RenderGame()
RotateMesh(Box, 0, 0.5, 0, #PB_Relative)
RenderWorld()
EndProcedure
; IDE Options = SpiderBasic 2.20 (Windows - x86)
; CursorPosition = 34
; Folding = -
; WebAppName = Mesh Pivot
; HtmlFilename = meshpivot.html
; JavaScriptFilename = meshpivot.js
; JavaScriptPath = sb
; iOSAppOrientation = 0
; AndroidAppOrientation = 0
; EnableXP
; CompileSourceDirectory