@gamelearn/arcade-components 2.13.4 → 2.14.1
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.
|
@@ -43,6 +43,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
43
43
|
|
|
44
44
|
var isMobile = (0, _deviceDetection.DeviceDetection)();
|
|
45
45
|
var defaultCamPos = [0, 14.63, 16];
|
|
46
|
+
var boneWhiteList = ['l_eye_jnt', 'l_eye', 'eye_l'];
|
|
46
47
|
|
|
47
48
|
function Panel(_ref) {
|
|
48
49
|
var _character$resource4, _character$resource6, _character$resource6$, _character$resource6$2, _character$resource7;
|
|
@@ -66,7 +67,6 @@ function Panel(_ref) {
|
|
|
66
67
|
});
|
|
67
68
|
}, [emitEvent]);
|
|
68
69
|
var model = (0, _react.useRef)();
|
|
69
|
-
var defaultClip = (0, _react.useRef)();
|
|
70
70
|
var emotion = (0, _react.useMemo)(function () {
|
|
71
71
|
if (isCharacter) {
|
|
72
72
|
var _character$animation, _character$resource, _character$resource$a, _character$resource$a2, _character$resource3, _character$resource3$;
|
|
@@ -129,14 +129,17 @@ function Panel(_ref) {
|
|
|
129
129
|
|
|
130
130
|
if (character.type === 'character' && defaultAnim) {
|
|
131
131
|
model.current = object;
|
|
132
|
-
|
|
132
|
+
var isSeated = character.emotion.includes('seated');
|
|
133
133
|
cameraRef.current.position.setY(size.y - 1.5 * 1.3); // Retro compatible with resources without eye bone
|
|
134
134
|
|
|
135
135
|
object.traverse(function (obj) {
|
|
136
|
-
|
|
136
|
+
var boneName = obj.name.toLowerCase();
|
|
137
|
+
|
|
138
|
+
if (obj.isBone && boneWhiteList.includes(boneName)) {
|
|
139
|
+
var distance = isSeated ? 5 : 0.5;
|
|
137
140
|
var leftEyeVector = new _three.Vector3().setFromMatrixPosition(obj.matrixWorld);
|
|
138
|
-
cameraRef.current.position.setX(leftEyeVector.x);
|
|
139
|
-
cameraRef.current.position.setY(leftEyeVector.y -
|
|
141
|
+
cameraRef.current.position.setX(leftEyeVector.x - 0.5);
|
|
142
|
+
cameraRef.current.position.setY(leftEyeVector.y - distance);
|
|
140
143
|
}
|
|
141
144
|
});
|
|
142
145
|
cameraRef.current.zoom = 1.85;
|
|
@@ -147,7 +150,7 @@ function Panel(_ref) {
|
|
|
147
150
|
|
|
148
151
|
cameraRef.current.updateProjectionMatrix();
|
|
149
152
|
}
|
|
150
|
-
}, [character.type]);
|
|
153
|
+
}, [character.type, character.emotion]);
|
|
151
154
|
(0, _fiber.useFrame)(function (_ref2) {
|
|
152
155
|
var gl = _ref2.gl;
|
|
153
156
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gamelearn/arcade-components",
|
|
3
3
|
"author": "Gamelearn",
|
|
4
4
|
"license": "unlicense",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.14.1",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime": "^7.18.6",
|
|
17
|
-
"@gamelearn/arcade-styles": "2.
|
|
17
|
+
"@gamelearn/arcade-styles": "2.10.0",
|
|
18
18
|
"@gamelearn/arcade-three-core": "1.17.2",
|
|
19
19
|
"@react-three/drei": "9.4.3",
|
|
20
20
|
"@react-three/fiber": "8.0.17",
|