@dcl/sdk 7.0.0-3516622799.commit-ce3da22 → 7.0.0-3516625640.commit-f059a45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,71 +30,79 @@ function createPlaneTexture(x: number, y: number, z: number): Entity {
|
|
30
30
|
}
|
31
31
|
|
32
32
|
function createBillboards() {
|
33
|
-
|
34
|
-
|
35
|
-
})
|
36
|
-
Billboard.create(createPlaneTexture(12, 3, 1))
|
33
|
+
const plane1 = createPlaneTexture(8, 3, 1)
|
34
|
+
const plane2 = createPlaneTexture(12, 3, 1)
|
37
35
|
createPlaneTexture(4, 3, 1)
|
38
36
|
|
39
|
-
|
40
|
-
|
37
|
+
const plane5 = createPlaneTexture(8, 3, 8)
|
38
|
+
const plane4 = createPlaneTexture(12, 3, 8)
|
39
|
+
createPlaneTexture(4, 3, 8)
|
40
|
+
|
41
|
+
Billboard.create(plane1, {
|
41
42
|
billboardMode: BillboardMode.BM_Y_AXE
|
42
43
|
})
|
43
|
-
Billboard.create(
|
44
|
+
Billboard.create(plane2)
|
45
|
+
Billboard.create(plane4, {
|
44
46
|
oppositeDirection: true,
|
45
47
|
billboardMode: BillboardMode.BM_ALL_AXES
|
46
48
|
})
|
47
|
-
|
49
|
+
Billboard.create(plane5, {
|
50
|
+
oppositeDirection: true,
|
51
|
+
billboardMode: BillboardMode.BM_Y_AXE
|
52
|
+
})
|
48
53
|
}
|
49
54
|
|
50
|
-
function createTextShape(text: string, position: Vector3
|
55
|
+
function createTextShape(text: string, position: Vector3, textColor: Color4) {
|
51
56
|
const entity = engine.addEntity()
|
52
57
|
Transform.create(entity, { position })
|
53
|
-
return TextShape.create(entity, {
|
58
|
+
return TextShape.create(entity, {
|
59
|
+
text,
|
60
|
+
fontSize: 3,
|
61
|
+
outlineWidth: 0.1,
|
62
|
+
outlineColor: Color3.Black(),
|
63
|
+
textColor
|
64
|
+
})
|
54
65
|
}
|
55
66
|
|
56
67
|
function createTextShapes() {
|
57
|
-
const
|
68
|
+
const regularColor = Color4.create(1, 0.2, 0.8, 0.8)
|
69
|
+
const oppositeColor = Color4.create(0.8, 0.2, 1, 0.8)
|
70
|
+
|
71
|
+
createTextShape(
|
58
72
|
'Regular, only Y-rotation',
|
59
|
-
Vector3.create(8, 1, 1)
|
73
|
+
Vector3.create(8, 1, 1),
|
74
|
+
regularColor
|
60
75
|
)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
const text2 = createTextShape('Regular', Vector3.create(12, 1, 1))
|
67
|
-
text2.fontSize = 3
|
68
|
-
text2.textColor = { r: 1, g: 0.2, b: 0.8, a: 0.8 }
|
69
|
-
text2.outlineColor = { r: 0, g: 0, b: 0 }
|
70
|
-
text2.outlineWidth = 0.1
|
71
|
-
|
72
|
-
const text3 = createTextShape('Without billboard', Vector3.create(4, 1, 1))
|
73
|
-
text3.fontSize = 3
|
74
|
-
text3.textColor = { r: 1, g: 0.2, b: 0.8, a: 0.8 }
|
75
|
-
text3.outlineColor = { r: 0, g: 0, b: 0 }
|
76
|
-
text3.outlineWidth = 0.1
|
77
|
-
|
78
|
-
const text4 = createTextShape('Opposite, only Y', Vector3.create(8, 1, 8))
|
79
|
-
text4.fontSize = 3
|
80
|
-
text4.textColor = { r: 0.8, g: 0.2, b: 1.0, a: 0.8 }
|
81
|
-
text4.outlineColor = { r: 0, g: 0, b: 0 }
|
82
|
-
text4.outlineWidth = 0.1
|
83
|
-
|
84
|
-
const text5 = createTextShape('Opposite', Vector3.create(12, 1, 8))
|
85
|
-
text5.fontSize = 3
|
86
|
-
text5.textColor = { r: 0.8, g: 0.2, b: 1.0, a: 0.8 }
|
87
|
-
text5.outlineColor = { r: 0, g: 0, b: 0 }
|
88
|
-
text5.outlineWidth = 0.1
|
89
|
-
|
90
|
-
const text6 = createTextShape('Without billboard', Vector3.create(4, 1, 8))
|
91
|
-
text6.fontSize = 3
|
92
|
-
text6.textColor = { r: 0.8, g: 0.2, b: 1.0, a: 0.8 }
|
93
|
-
text6.outlineColor = { r: 0, g: 0, b: 0 }
|
94
|
-
text6.outlineWidth = 0.1
|
76
|
+
createTextShape('Regular', Vector3.create(12, 1, 1), regularColor)
|
77
|
+
createTextShape('Without billboard', Vector3.create(4, 1, 1), regularColor)
|
78
|
+
createTextShape('Opposite, only Y', Vector3.create(8, 1, 8), oppositeColor)
|
79
|
+
createTextShape('Opposite', Vector3.create(12, 1, 8), oppositeColor)
|
80
|
+
createTextShape('Without billboard', Vector3.create(4, 1, 8), oppositeColor)
|
95
81
|
}
|
96
82
|
|
97
83
|
createBillboards()
|
98
84
|
createTextShapes()
|
99
85
|
|
86
|
+
const BouncingBillboard = engine.defineComponent(
|
87
|
+
{
|
88
|
+
t: Schemas.Number,
|
89
|
+
originalPosition: Schemas.Vector3
|
90
|
+
},
|
91
|
+
123123
|
92
|
+
)
|
93
|
+
|
94
|
+
engine.addSystem((dt: number) => {
|
95
|
+
for (const [entity] of engine.getEntitiesWith(Billboard, Transform)) {
|
96
|
+
if (BouncingBillboard.getOrNull(entity) === null) {
|
97
|
+
BouncingBillboard.create(entity, {
|
98
|
+
originalPosition: Transform.get(entity).position
|
99
|
+
})
|
100
|
+
}
|
101
|
+
|
102
|
+
const bounce = BouncingBillboard.getMutable(entity)
|
103
|
+
bounce.t += dt
|
100
104
|
|
105
|
+
Transform.getMutable(entity).position.y =
|
106
|
+
bounce.originalPosition.y + 0.05 * Math.sin(10 * bounce.t)
|
107
|
+
}
|
108
|
+
})
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/sdk",
|
3
|
-
"version": "7.0.0-
|
3
|
+
"version": "7.0.0-3516625640.commit-f059a45",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/src/index.js",
|
6
6
|
"typings": "dist/index.d.ts",
|
@@ -23,13 +23,13 @@
|
|
23
23
|
"artifacts"
|
24
24
|
],
|
25
25
|
"dependencies": {
|
26
|
-
"@dcl/amd": "7.0.0-
|
27
|
-
"@dcl/build-ecs": "7.0.0-
|
28
|
-
"@dcl/js-runtime": "7.0.0-
|
26
|
+
"@dcl/amd": "7.0.0-3516625640.commit-f059a45",
|
27
|
+
"@dcl/build-ecs": "7.0.0-3516625640.commit-f059a45",
|
28
|
+
"@dcl/js-runtime": "7.0.0-3516625640.commit-f059a45",
|
29
29
|
"@dcl/kernel": "^1.0.0-3339209749.commit-fa9e5d7",
|
30
30
|
"@dcl/posix": "^1.0.4",
|
31
31
|
"@dcl/unity-renderer": "^1.0.59980-20221027151836.commit-cc26142"
|
32
32
|
},
|
33
33
|
"minCliVersion": "3.12.3",
|
34
|
-
"commit": "
|
34
|
+
"commit": "f059a450ced467827681c935f0256e0ff8789040"
|
35
35
|
}
|