Skip to content

Commit 384d00d

Browse files
authored
[Community] [3D raycast] Fix normal vector value for models too (#1688)
- Don't show in changelog
1 parent bcca752 commit 384d00d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

extensions/community/Raycaster3D.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"name": "Raycaster3D",
1010
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8419f46b76bce482c14b4c03b4141a64d457e4cdc92686f3470381f5d2694abd_ray-start-arrow.svg",
1111
"shortDescription": "Find 3D objects that cross a line.",
12-
"version": "0.1.6",
12+
"version": "0.1.7",
1313
"description": [
1414
"It can be useful to:",
1515
"- Find 3D objects under the pointer",
@@ -201,7 +201,10 @@
201201
" _doRecast(objectsLists, objects) {",
202202
" const raycastResults = this.raycastResults;",
203203
" let distanceMin = Number.MAX_VALUE;",
204+
" /** @type {gdjs.RuntimeObject | null} */",
204205
" let nearestObject = null;",
206+
" /** @type {THREE.Object3D | null} */",
207+
" let nearestThreeObject = null;",
205208
" for (const object of objects) {",
206209
" raycastResults.length = 0;",
207210
" const threeObject = object.get3DRendererObject();",
@@ -218,12 +221,13 @@
218221
" this.lastPositionY = -raycastResult.point.y;",
219222
" this.lastPositionZ = raycastResult.point.z;",
220223
" this.lastNormal.copy(raycastResult.normal);",
224+
" nearestThreeObject = raycastResult.object;",
221225
" }",
222226
" }",
223227
" if (!nearestObject) {",
224228
" return false;",
225229
" }",
226-
" this.lastNormal.transformDirection(nearestObject.get3DRendererObject().matrixWorld);",
230+
" this.lastNormal.transformDirection(nearestThreeObject.matrixWorld);",
227231
" this.lastNormal.y = -this.lastNormal.y;",
228232
" raycastResults.length = 0;",
229233
" gdjs.evtTools.object.pickOnly(",

0 commit comments

Comments
 (0)