|
2 | 2 | "author": "", |
3 | 3 | "category": "General", |
4 | 4 | "extensionNamespace": "", |
5 | | - "gdevelopVersion": ">=5.5.222", |
6 | 5 | "fullName": "3D raycast", |
| 6 | + "gdevelopVersion": ">=5.5.222", |
7 | 7 | "helpPath": "", |
8 | 8 | "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXJheS1zdGFydC1hcnJvdyIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik0yMywxMkwxOSwxNlYxM0g2LjgzQzYuNDIsMTQuMTcgNS4zMSwxNSA0LDE1QTMsMyAwIDAsMSAxLDEyQTMsMyAwIDAsMSA0LDlDNS4zMSw5IDYuNDIsOS44MyA2LjgzLDExSDE5VjhMMjMsMTJaIiAvPjwvc3ZnPg==", |
9 | 9 | "name": "Raycaster3D", |
10 | 10 | "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/8419f46b76bce482c14b4c03b4141a64d457e4cdc92686f3470381f5d2694abd_ray-start-arrow.svg", |
11 | 11 | "shortDescription": "Find 3D objects that cross a line.", |
12 | | - "version": "0.1.4", |
| 12 | + "version": "0.1.5", |
13 | 13 | "description": [ |
14 | 14 | "It can be useful to:", |
15 | 15 | "- Find 3D objects under the pointer", |
|
29 | 29 | "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" |
30 | 30 | ], |
31 | 31 | "dependencies": [], |
| 32 | + "globalVariables": [], |
| 33 | + "sceneVariables": [], |
32 | 34 | "eventsFunctions": [ |
33 | 35 | { |
34 | 36 | "fullName": "", |
|
496 | 498 | ], |
497 | 499 | "objectGroups": [] |
498 | 500 | }, |
| 501 | + { |
| 502 | + "description": "Sends a ray from the cursor on the camera screen, intersecting the closest object. The intersected object will become the only one taken into account.", |
| 503 | + "fullName": "Raycast from cursor", |
| 504 | + "functionType": "Condition", |
| 505 | + "group": "Collision", |
| 506 | + "name": "RaycastFromCameraCursor", |
| 507 | + "sentence": "Cast a ray from the cursor on 2D layer: _PARAM2_ to a maximum distance of _PARAM3_ against _PARAM1_", |
| 508 | + "events": [ |
| 509 | + { |
| 510 | + "type": "BuiltinCommonInstructions::JsCode", |
| 511 | + "inlineCode": [ |
| 512 | + "const { camera, input } = gdjs.evtTools;", |
| 513 | + "", |
| 514 | + "const layer2D = eventsFunctionContext.getArgument(\"Layer2D\");", |
| 515 | + "", |
| 516 | + "const cameraMinX = camera.getCameraBorderLeft(runtimeScene, layer2D, 0);", |
| 517 | + "const cameraMaxX = camera.getCameraBorderRight(runtimeScene, layer2D, 0);", |
| 518 | + "const cameraMinY = camera.getCameraBorderTop(runtimeScene, layer2D, 0);", |
| 519 | + "const cameraMaxY = camera.getCameraBorderBottom(runtimeScene, layer2D, 0);", |
| 520 | + "", |
| 521 | + "const cursorX = input.getCursorX(runtimeScene, layer2D, 0);", |
| 522 | + "const cursorY = input.getCursorY(runtimeScene, layer2D, 0);", |
| 523 | + "", |
| 524 | + "eventsFunctionContext.returnValue =", |
| 525 | + " gdjs.__raycaster3DExtension.raycaster.recastFromCamera(", |
| 526 | + " eventsFunctionContext.getObjectsLists(\"Object\"),", |
| 527 | + " objects,", |
| 528 | + " (cursorX - cameraMinX) / (cameraMaxX - cameraMinX),", |
| 529 | + " (cursorY - cameraMinY) / (cameraMaxY - cameraMinY),", |
| 530 | + " eventsFunctionContext.getArgument(\"DistanceMax\")", |
| 531 | + " );", |
| 532 | + "" |
| 533 | + ], |
| 534 | + "parameterObjects": "Object", |
| 535 | + "useStrict": true, |
| 536 | + "eventsSheetExpanded": true |
| 537 | + } |
| 538 | + ], |
| 539 | + "parameters": [ |
| 540 | + { |
| 541 | + "description": "Objects to test against the ray", |
| 542 | + "name": "Object", |
| 543 | + "type": "objectList" |
| 544 | + }, |
| 545 | + { |
| 546 | + "description": "2D layer", |
| 547 | + "name": "Layer2D", |
| 548 | + "type": "layer" |
| 549 | + }, |
| 550 | + { |
| 551 | + "description": "Ray maximum distance (in pixels)", |
| 552 | + "name": "DistanceMax", |
| 553 | + "type": "expression" |
| 554 | + } |
| 555 | + ], |
| 556 | + "objectGroups": [] |
| 557 | + }, |
499 | 558 | { |
500 | 559 | "description": "the last recast intersection distance.", |
501 | 560 | "fullName": "Last recast distance", |
|
0 commit comments