From 0b30635fefb067170066dc6abee2730cb5ce88f5 Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:50:22 +0900 Subject: [PATCH 1/6] [Community] [Convert3dToScreenPosition] v0.1.0 --- .../community/Convert3dToScreenPosition.json | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 extensions/community/Convert3dToScreenPosition.json diff --git a/extensions/community/Convert3dToScreenPosition.json b/extensions/community/Convert3dToScreenPosition.json new file mode 100644 index 000000000..77a7a5e42 --- /dev/null +++ b/extensions/community/Convert3dToScreenPosition.json @@ -0,0 +1,160 @@ +{ + "author": "", + "category": "", + "extensionNamespace": "", + "fullName": "Convert 3D position to screen position", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDEwLjljMCw3LTgsMTMuMS04LDEzLjFzLTgtNi4xLTgtMTMuMUM4LDYuNSwxMS42LDMsMTYsM1MyNCw2LjUsMjQsMTAuOXoiLz4NCjxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE2IiBjeT0iMTEiIHI9IjIiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjE5LjIsMjEgMjUsMjEgMjksMjkgMywyOSA3LDIxIDEyLjgsMjEgIi8+DQo8L3N2Zz4NCg==", + "name": "Convert3dToScreenPosition", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", + "shortDescription": "This extension provides functionality to convert 3D position to screen position.", + "version": "0.1.0", + "description": [ + "This extension provides functionality to convert 3D position to screen position. ", + "", + "- \"Overlap\" action: Overlaps objects with a 3D object." + ], + "tags": [ + "3D" + ], + "authorIds": [ + "Zu55H5hcb9YmZTltIVOTAFDJQyB2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.__Convert3dToScreenPosition) {", + " return;", + "}", + "if (!runtimeScene.getLayer(\"\").getRenderer().getThreeCamera()) {", + " return;", + "}", + "gdjs.__Convert3dToScreenPosition = new Map();", + "gdjs.__Convert3dToScreenPosition.set(\"convert\", (Layer, X, Y, Z)=>{", + " const Camera3D = runtimeScene.getLayer(Layer).getRenderer().getThreeCamera();", + " const Position3D = new THREE.Vector3(X, -Y, Z);", + " const Project = Position3D.clone().project(Camera3D);", + " const GameResolutionWidth = runtimeScene.getGame().getGameResolutionWidth();", + " const GameResolutionHeight = runtimeScene.getGame().getGameResolutionHeight();", + " const PointX = (GameResolutionWidth / 2) * (Project.x + 1.0);", + " const PointY = (GameResolutionHeight / 2) * ((Project.y * -1) + 1.0);", + " //", + " const Frustum = new THREE.Frustum();", + " const CloneCamera = Camera3D.clone();", + " CloneCamera.rotateZ(gdjs.toRad(180));", + " Frustum.setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(CloneCamera.projectionMatrix, CloneCamera.matrixWorldInverse));", + " const Within = Frustum.containsPoint(Position3D);", + " return [PointX, PointY, Within];", + "});" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Overlaps objects with a 3D object.\n⚠️ For objects to overlap correctly, they must be on a different layer than the 3D object.", + "fullName": "Overlap", + "functionType": "Action", + "group": "Position", + "name": "Overlap", + "sentence": "Overlap _PARAM1_ (Hide: _PARAM2_) and _PARAM3_ (Offset: _PARAM5_, _PARAM6_, _PARAM7_) objects.", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (!gdjs.__Convert3dToScreenPosition) {", + " return;", + "}", + "const Object2Ds = eventsFunctionContext.getObjects(\"Object2D\");", + "const Hide = eventsFunctionContext.getArgument(\"Hide\");", + "const Object3D = eventsFunctionContext.getObjects(\"Object3D\")[0];", + "const OffsetX = eventsFunctionContext.getArgument(\"OffsetX\");", + "const OffsetY = eventsFunctionContext.getArgument(\"OffsetY\");", + "const OffsetZ = eventsFunctionContext.getArgument(\"OffsetZ\");", + "const Offset3D = new THREE.Vector3(OffsetX, OffsetY, OffsetZ);", + "const Layer3D = Object3D.layer;", + "const RendererObject3D = Object3D.get3DRendererObject();", + "if (!runtimeScene.getLayer(Layer3D).getRenderer().getThreeCamera()) {", + " return;", + "}", + "//", + "let Position3D;", + "if (RendererObject3D) {", + " // 3D", + " Position3D = RendererObject3D.position.clone();", + "} else {", + " // 2D", + " Position3D = new THREE.Vector3(Object3D.getX(), Object3D.getY(), 0);", + "}", + "Position3D.add(Offset3D);", + "for (const Object2D of Object2Ds) {", + " const Result = gdjs.__Convert3dToScreenPosition.get(\"convert\")(Layer3D, Position3D.x, Position3D.y, Position3D.z);", + " Object2D.setPosition(Result[0], Result[1]);", + " Object2D.hide(!Result[2]);", + "}", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "2D Object", + "name": "Object2D", + "type": "objectList" + }, + { + "defaultValue": "yes", + "description": "Hide when behind the 3D camera", + "longDescription": "Hide 2D objects when 3D objects are behind the 3D camera.", + "name": "Hide", + "optional": true, + "type": "yesorno" + }, + { + "description": "Target 3D Object", + "name": "Object3D", + "type": "objectList" + }, + { + "description": "3D Capability", + "name": "Capability3D", + "supplementaryInformation": "Scene3D::Base3DBehavior", + "type": "behavior" + }, + { + "description": "X Offset", + "name": "OffsetX", + "type": "expression" + }, + { + "description": "Y Offset", + "name": "OffsetY", + "type": "expression" + }, + { + "description": "Z Offset", + "name": "OffsetZ", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file From d4a23065f074dc17cac726a64ef392e4ca082be3 Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 21 Mar 2024 21:57:38 +0900 Subject: [PATCH 2/6] [Community] [Convert3dToScreenPosition] v0.1.1 --- .../Convert3dToScreenPosition0.1.1.json | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 extensions/community/Convert3dToScreenPosition0.1.1.json diff --git a/extensions/community/Convert3dToScreenPosition0.1.1.json b/extensions/community/Convert3dToScreenPosition0.1.1.json new file mode 100644 index 000000000..2d8c7c766 --- /dev/null +++ b/extensions/community/Convert3dToScreenPosition0.1.1.json @@ -0,0 +1,164 @@ +{ + "author": "", + "category": "", + "extensionNamespace": "", + "fullName": "Convert 3D position to screen position", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDEwLjljMCw3LTgsMTMuMS04LDEzLjFzLTgtNi4xLTgtMTMuMUM4LDYuNSwxMS42LDMsMTYsM1MyNCw2LjUsMjQsMTAuOXoiLz4NCjxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE2IiBjeT0iMTEiIHI9IjIiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjE5LjIsMjEgMjUsMjEgMjksMjkgMywyOSA3LDIxIDEyLjgsMjEgIi8+DQo8L3N2Zz4NCg==", + "name": "Convert3dToScreenPosition", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", + "shortDescription": "This extension provides functionality to convert 3D position to screen position.", + "version": "0.1.1", + "description": [ + "This extension provides functionality to convert 3D position to screen position. ", + "", + "The following actions are added to the object:", + "- \"Overlap\" action: Overlaps objects with a 3D object." + ], + "tags": [ + "3D" + ], + "authorIds": [ + "Zu55H5hcb9YmZTltIVOTAFDJQyB2" + ], + "dependencies": [], + "eventsFunctions": [ + { + "fullName": "", + "functionType": "Action", + "name": "onSceneLoaded", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (gdjs.__Convert3dToScreenPosition) {", + " return;", + "}", + "if (!runtimeScene.getLayer(\"\").getRenderer().getThreeCamera()) {", + " return;", + "}", + "gdjs.__Convert3dToScreenPosition = new Map();", + "gdjs.__Convert3dToScreenPosition.set(\"convert\", (Layer, X, Y, Z)=>{", + " const Camera3D = runtimeScene.getLayer(Layer).getRenderer().getThreeCamera();", + " const Position3D = new THREE.Vector3(X, -Y, Z);", + " const Project = Position3D.clone().project(Camera3D);", + " const GameResolutionWidth = runtimeScene.getGame().getGameResolutionWidth();", + " const GameResolutionHeight = runtimeScene.getGame().getGameResolutionHeight();", + " const PointX = (GameResolutionWidth / 2) * (Project.x + 1.0);", + " const PointY = (GameResolutionHeight / 2) * ((Project.y * -1) + 1.0);", + " //", + " const Frustum = new THREE.Frustum();", + " const CloneCamera = Camera3D.clone();", + " CloneCamera.rotateZ(gdjs.toRad(180));", + " Frustum.setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(CloneCamera.projectionMatrix, CloneCamera.matrixWorldInverse));", + " const Within = Frustum.containsPoint(Position3D);", + " return [PointX, PointY, Within];", + "});" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Overlaps objects with a 3D object.\n⚠️ For objects to overlap correctly, they must be on a different layer than the 3D object.", + "fullName": "Overlap", + "functionType": "Action", + "group": "Position", + "name": "Overlap", + "sentence": "Overlap _PARAM1_ (Hide: _PARAM2_) and _PARAM3_ (Offset: _PARAM5_, _PARAM6_, _PARAM7_) objects.", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "if (!gdjs.__Convert3dToScreenPosition) {", + " return;", + "}", + "const Object2Ds = eventsFunctionContext.getObjects(\"Object2D\");", + "const Hide = eventsFunctionContext.getArgument(\"Hide\");", + "const Object3D = eventsFunctionContext.getObjects(\"Object3D\")[0];", + "const OffsetX = eventsFunctionContext.getArgument(\"OffsetX\");", + "const OffsetY = eventsFunctionContext.getArgument(\"OffsetY\");", + "const OffsetZ = eventsFunctionContext.getArgument(\"OffsetZ\");", + "const Offset3D = new THREE.Vector3(OffsetX, OffsetY, OffsetZ);", + "if (!Object3D) {", + " return;", + "}", + "const Layer3D = Object3D.layer;", + "const RendererObject3D = Object3D.get3DRendererObject();", + "if (!runtimeScene.getLayer(Layer3D).getRenderer().getThreeCamera()) {", + " return;", + "}", + "//", + "let Position3D;", + "if (RendererObject3D) {", + " // 3D", + " Position3D = RendererObject3D.position.clone();", + "} else {", + " // 2D", + " Position3D = new THREE.Vector3(Object3D.getX(), Object3D.getY(), 0);", + "}", + "Position3D.add(Offset3D);", + "for (const Object2D of Object2Ds) {", + " const Result = gdjs.__Convert3dToScreenPosition.get(\"convert\")(Layer3D, Position3D.x, Position3D.y, Position3D.z);", + " Object2D.setPosition(Result[0], Result[1]);", + " Object2D.hide(!Result[2]);", + "}", + "" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": true + } + ], + "parameters": [ + { + "description": "2D Object", + "name": "Object2D", + "type": "objectList" + }, + { + "defaultValue": "yes", + "description": "Hide when behind the 3D camera", + "longDescription": "Hide 2D objects when 3D objects are behind the 3D camera.", + "name": "Hide", + "optional": true, + "type": "yesorno" + }, + { + "description": "Target 3D Object", + "name": "Object3D", + "type": "objectList" + }, + { + "description": "3D Capability", + "name": "Capability3D", + "supplementaryInformation": "Scene3D::Base3DBehavior", + "type": "behavior" + }, + { + "description": "X Offset", + "name": "OffsetX", + "type": "expression" + }, + { + "description": "Y Offset", + "name": "OffsetY", + "type": "expression" + }, + { + "description": "Z Offset", + "name": "OffsetZ", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +} \ No newline at end of file From fb9beeb77244330e5643f1ea852ed17cc76ec09a Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:03:16 +0900 Subject: [PATCH 3/6] Delete extensions/community/Convert3dToScreenPosition0.1.1.json miss --- .../Convert3dToScreenPosition0.1.1.json | 164 ------------------ 1 file changed, 164 deletions(-) delete mode 100644 extensions/community/Convert3dToScreenPosition0.1.1.json diff --git a/extensions/community/Convert3dToScreenPosition0.1.1.json b/extensions/community/Convert3dToScreenPosition0.1.1.json deleted file mode 100644 index 2d8c7c766..000000000 --- a/extensions/community/Convert3dToScreenPosition0.1.1.json +++ /dev/null @@ -1,164 +0,0 @@ -{ - "author": "", - "category": "", - "extensionNamespace": "", - "fullName": "Convert 3D position to screen position", - "helpPath": "", - "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggY2xhc3M9InN0MCIgZD0iTTI0LDEwLjljMCw3LTgsMTMuMS04LDEzLjFzLTgtNi4xLTgtMTMuMUM4LDYuNSwxMS42LDMsMTYsM1MyNCw2LjUsMjQsMTAuOXoiLz4NCjxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE2IiBjeT0iMTEiIHI9IjIiLz4NCjxwb2x5bGluZSBjbGFzcz0ic3QwIiBwb2ludHM9IjE5LjIsMjEgMjUsMjEgMjksMjkgMywyOSA3LDIxIDEyLjgsMjEgIi8+DQo8L3N2Zz4NCg==", - "name": "Convert3dToScreenPosition", - "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", - "shortDescription": "This extension provides functionality to convert 3D position to screen position.", - "version": "0.1.1", - "description": [ - "This extension provides functionality to convert 3D position to screen position. ", - "", - "The following actions are added to the object:", - "- \"Overlap\" action: Overlaps objects with a 3D object." - ], - "tags": [ - "3D" - ], - "authorIds": [ - "Zu55H5hcb9YmZTltIVOTAFDJQyB2" - ], - "dependencies": [], - "eventsFunctions": [ - { - "fullName": "", - "functionType": "Action", - "name": "onSceneLoaded", - "sentence": "", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "if (gdjs.__Convert3dToScreenPosition) {", - " return;", - "}", - "if (!runtimeScene.getLayer(\"\").getRenderer().getThreeCamera()) {", - " return;", - "}", - "gdjs.__Convert3dToScreenPosition = new Map();", - "gdjs.__Convert3dToScreenPosition.set(\"convert\", (Layer, X, Y, Z)=>{", - " const Camera3D = runtimeScene.getLayer(Layer).getRenderer().getThreeCamera();", - " const Position3D = new THREE.Vector3(X, -Y, Z);", - " const Project = Position3D.clone().project(Camera3D);", - " const GameResolutionWidth = runtimeScene.getGame().getGameResolutionWidth();", - " const GameResolutionHeight = runtimeScene.getGame().getGameResolutionHeight();", - " const PointX = (GameResolutionWidth / 2) * (Project.x + 1.0);", - " const PointY = (GameResolutionHeight / 2) * ((Project.y * -1) + 1.0);", - " //", - " const Frustum = new THREE.Frustum();", - " const CloneCamera = Camera3D.clone();", - " CloneCamera.rotateZ(gdjs.toRad(180));", - " Frustum.setFromProjectionMatrix(new THREE.Matrix4().multiplyMatrices(CloneCamera.projectionMatrix, CloneCamera.matrixWorldInverse));", - " const Within = Frustum.containsPoint(Position3D);", - " return [PointX, PointY, Within];", - "});" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [], - "objectGroups": [] - }, - { - "description": "Overlaps objects with a 3D object.\n⚠️ For objects to overlap correctly, they must be on a different layer than the 3D object.", - "fullName": "Overlap", - "functionType": "Action", - "group": "Position", - "name": "Overlap", - "sentence": "Overlap _PARAM1_ (Hide: _PARAM2_) and _PARAM3_ (Offset: _PARAM5_, _PARAM6_, _PARAM7_) objects.", - "events": [ - { - "type": "BuiltinCommonInstructions::JsCode", - "inlineCode": [ - "if (!gdjs.__Convert3dToScreenPosition) {", - " return;", - "}", - "const Object2Ds = eventsFunctionContext.getObjects(\"Object2D\");", - "const Hide = eventsFunctionContext.getArgument(\"Hide\");", - "const Object3D = eventsFunctionContext.getObjects(\"Object3D\")[0];", - "const OffsetX = eventsFunctionContext.getArgument(\"OffsetX\");", - "const OffsetY = eventsFunctionContext.getArgument(\"OffsetY\");", - "const OffsetZ = eventsFunctionContext.getArgument(\"OffsetZ\");", - "const Offset3D = new THREE.Vector3(OffsetX, OffsetY, OffsetZ);", - "if (!Object3D) {", - " return;", - "}", - "const Layer3D = Object3D.layer;", - "const RendererObject3D = Object3D.get3DRendererObject();", - "if (!runtimeScene.getLayer(Layer3D).getRenderer().getThreeCamera()) {", - " return;", - "}", - "//", - "let Position3D;", - "if (RendererObject3D) {", - " // 3D", - " Position3D = RendererObject3D.position.clone();", - "} else {", - " // 2D", - " Position3D = new THREE.Vector3(Object3D.getX(), Object3D.getY(), 0);", - "}", - "Position3D.add(Offset3D);", - "for (const Object2D of Object2Ds) {", - " const Result = gdjs.__Convert3dToScreenPosition.get(\"convert\")(Layer3D, Position3D.x, Position3D.y, Position3D.z);", - " Object2D.setPosition(Result[0], Result[1]);", - " Object2D.hide(!Result[2]);", - "}", - "" - ], - "parameterObjects": "", - "useStrict": true, - "eventsSheetExpanded": true - } - ], - "parameters": [ - { - "description": "2D Object", - "name": "Object2D", - "type": "objectList" - }, - { - "defaultValue": "yes", - "description": "Hide when behind the 3D camera", - "longDescription": "Hide 2D objects when 3D objects are behind the 3D camera.", - "name": "Hide", - "optional": true, - "type": "yesorno" - }, - { - "description": "Target 3D Object", - "name": "Object3D", - "type": "objectList" - }, - { - "description": "3D Capability", - "name": "Capability3D", - "supplementaryInformation": "Scene3D::Base3DBehavior", - "type": "behavior" - }, - { - "description": "X Offset", - "name": "OffsetX", - "type": "expression" - }, - { - "description": "Y Offset", - "name": "OffsetY", - "type": "expression" - }, - { - "description": "Z Offset", - "name": "OffsetZ", - "type": "expression" - } - ], - "objectGroups": [] - } - ], - "eventsBasedBehaviors": [], - "eventsBasedObjects": [] -} \ No newline at end of file From a627487f34be5517526df1c3402c1d7fd65ca9f8 Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:03:56 +0900 Subject: [PATCH 4/6] [Community] [Convert3dToScreenPosition] v0.1.1 --- extensions/community/Convert3dToScreenPosition.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/community/Convert3dToScreenPosition.json b/extensions/community/Convert3dToScreenPosition.json index 77a7a5e42..2d8c7c766 100644 --- a/extensions/community/Convert3dToScreenPosition.json +++ b/extensions/community/Convert3dToScreenPosition.json @@ -8,10 +8,11 @@ "name": "Convert3dToScreenPosition", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", "shortDescription": "This extension provides functionality to convert 3D position to screen position.", - "version": "0.1.0", + "version": "0.1.1", "description": [ "This extension provides functionality to convert 3D position to screen position. ", "", + "The following actions are added to the object:", "- \"Overlap\" action: Overlaps objects with a 3D object." ], "tags": [ @@ -84,6 +85,9 @@ "const OffsetY = eventsFunctionContext.getArgument(\"OffsetY\");", "const OffsetZ = eventsFunctionContext.getArgument(\"OffsetZ\");", "const Offset3D = new THREE.Vector3(OffsetX, OffsetY, OffsetZ);", + "if (!Object3D) {", + " return;", + "}", "const Layer3D = Object3D.layer;", "const RendererObject3D = Object3D.get3DRendererObject();", "if (!runtimeScene.getLayer(Layer3D).getRenderer().getThreeCamera()) {", From e09150fc0a0243dc37c463e23af363e7968d417b Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 21 Mar 2024 22:14:21 +0900 Subject: [PATCH 5/6] [Community] [Convert3dToScreenPosition] v0.1.2 Deleted a dot. --- extensions/community/Convert3dToScreenPosition.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/community/Convert3dToScreenPosition.json b/extensions/community/Convert3dToScreenPosition.json index 2d8c7c766..8609c0eaa 100644 --- a/extensions/community/Convert3dToScreenPosition.json +++ b/extensions/community/Convert3dToScreenPosition.json @@ -8,7 +8,7 @@ "name": "Convert3dToScreenPosition", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", "shortDescription": "This extension provides functionality to convert 3D position to screen position.", - "version": "0.1.1", + "version": "0.1.2", "description": [ "This extension provides functionality to convert 3D position to screen position. ", "", @@ -70,7 +70,7 @@ "functionType": "Action", "group": "Position", "name": "Overlap", - "sentence": "Overlap _PARAM1_ (Hide: _PARAM2_) and _PARAM3_ (Offset: _PARAM5_, _PARAM6_, _PARAM7_) objects.", + "sentence": "Overlap _PARAM1_ (Hide: _PARAM2_) and _PARAM3_ (Offset: _PARAM5_, _PARAM6_, _PARAM7_) objects", "events": [ { "type": "BuiltinCommonInstructions::JsCode", From b4f1ec55f3f8a02015d92179d2769d78b886660c Mon Sep 17 00:00:00 2001 From: PANDAKO-GitHub <68310169+PANDAKO-GitHub@users.noreply.github.com> Date: Thu, 11 Apr 2024 17:45:57 +0900 Subject: [PATCH 6/6] [Community] [Convert3dToScreenPosition] v0.1.3 Fixed an issue that occurred during scene transitions. --- extensions/community/Convert3dToScreenPosition.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/community/Convert3dToScreenPosition.json b/extensions/community/Convert3dToScreenPosition.json index 8609c0eaa..bf8d8d599 100644 --- a/extensions/community/Convert3dToScreenPosition.json +++ b/extensions/community/Convert3dToScreenPosition.json @@ -8,7 +8,7 @@ "name": "Convert3dToScreenPosition", "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Line Hero Pack/Master/SVG/Maps and Navigation/5f308b28df69a05ce442f41f469dbeeae407726098ae481cbc58efb4f3514fe6_Maps and Navigation_location_pin_map.svg", "shortDescription": "This extension provides functionality to convert 3D position to screen position.", - "version": "0.1.2", + "version": "0.1.3", "description": [ "This extension provides functionality to convert 3D position to screen position. ", "", @@ -33,7 +33,7 @@ "type": "BuiltinCommonInstructions::JsCode", "inlineCode": [ "if (gdjs.__Convert3dToScreenPosition) {", - " return;", + " // return;", "}", "if (!runtimeScene.getLayer(\"\").getRenderer().getThreeCamera()) {", " return;",