Custom Gesture Interaction Method and Related Devices on iOS System

By fixing the position of the 3D rendering engine's camera and 3D model on the iOS system and adding custom gesture interactions to the 3D model, the problem of inconsistency between the interaction and state of the 3D model is solved, and the consistency between the interaction and state of the 3D model in any scene is achieved.

CN119597156BActive Publication Date: 2025-06-10HUNAN MANGO DIGITAL INTELLIGENCE ART TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510142526.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-10
Publication Date
2025-06-10
Estimated Expiration
2045-02-10

AI Technical Summary

Technical Problem

On iOS system, the interaction and state of the 3D model are inconsistent with the camera when rotating it, resulting in the problem that the model interaction gestures are inconsistent with the state of the 3D model.

Method used

By fixing the camera that comes with the 3D rendering engine at the origin of the 3D coordinate system scene and fixing the 3D model at the position of the 3D coordinate system scene with the camera as the origin, camera interaction is prohibited and custom gesture interaction is added to the 3D model.

Benefits of technology

The interaction and state consistency of the 3D model in any scene is achieved. Users can interact with the 3D model through custom gestures, avoiding the problem of inconsistency in model state caused by camera rotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597156B_ABST
    Figure CN119597156B_ABST
Patent Text Reader

Abstract

The present invention discloses a custom gesture interaction method and related devices on an iOS system, which are applied to the field of operating systems. The present invention can fix the camera of a 3D rendering engine at the origin of a 3D coordinate system scene of an iOS system; fix a 3D model at the first position of a 3D coordinate system scene with the camera as the origin; and add a model interaction gesture to the 3D model. The present invention can disable the camera interaction method of the 3D rendering engine, redefine the position between the camera and the 3D model, and add a model interaction gesture to the 3D model, so that the interaction method in the 3D rendering engine is transferred from the camera to the 3D model, and the user can interact with the 3D model through gestures, thereby ensuring the consistency of the interaction and state of the 3D model in any scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of operating systems, and in particular to a custom gesture interaction method and related devices on an iOS system. Background Art

[0002] When the iOS platform renders 3D models based on the 3D rendering engine, the system's built-in model interaction implementation method is based on camera interaction. When the camera rotates, the 3D coordinate system where the 3D model is located rotates, which affects all nodes in the 3D coordinate system, causing the position of the 3D model light tube node to rotate, resulting in inconsistencies between the model interaction gesture and the 3D model state, etc. Therefore, how to ensure the consistency of the interaction and state of the 3D model in any scenario has become a technical problem that people in this field need to solve urgently. Summary of the invention

[0003] In view of the above problems, the present invention provides a method and related apparatus for customizing gesture interaction on an iOS system, which overcomes the above problems or at least partially solves the above problems.

[0004] In a first aspect, a custom gesture interaction method on an iOS system includes:

[0005] The camera of the 3D rendering engine is fixed at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the imaging direction of the camera is along the negative direction of the z-axis;

[0006] Fixing the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented based on the SCNVector3 structure;

[0007] A model interaction gesture is added to the 3D model to facilitate the user to perform gesture interaction with the 3D model in the 3D rendering engine.

[0008] Optionally, in some optional embodiments, after fixing the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, the method further includes:

[0009] Calculate the difference between the maximum bounding box and the minimum bounding box in each 3D model to obtain a vector size, wherein the vector size includes a length, a width, and a height;

[0010] determining a maximum value from among said length, width and height;

[0011] Place the 3D model in a bounding box with a vector size of 1, so that the scaling ratio of each 3D model is unified to 1 / maximum value.

[0012] Optionally, in some alternative embodiments, adding model interaction gestures to the 3D model to facilitate gesture interaction between the user and the 3D model in the 3D rendering engine includes:

[0013] Using the gesture addition method defined by the iOS system, add iOS system model interaction gestures to the 3D model;

[0014] Set the maximum number of fingers recognized by the model interaction gesture to 1 to facilitate single-finger gesture interaction between the user and the 3D model.

[0015] Optionally, in some alternative embodiments, setting the maximum number of fingers recognized by the model interaction gesture to 1 to facilitate single-finger gesture interaction between the user and the 3D model includes:

[0016] Set the maximum number of fingers recognized by the model interaction gesture to 1;

[0017] When single-finger swipe data of the user in the screen coordinate system is obtained, calculate the rotation axis of the 3D model and the finger movement distance corresponding to the single-finger swipe data in the 3D model according to the X-axis offset distance and Y-axis offset distance in the single-finger swipe data;

[0018] Calculate the rotation angle of the 3D model according to the finger movement distance;

[0019] Calculate the rotation factor of the 3D model rotation according to the rotation angle of the 3D model;

[0020] Obtain the quaternion of the single-finger swipe data in the 3D coordinate system scene according to the rotation axis, the angle, and the rotation factor;

[0021] Control the 3D model to rotate based on the quaternion to achieve single-finger gesture interaction between the user and the 3D model.

[0022] Optionally, in some alternative embodiments, adding model interaction gestures to the 3D model to facilitate gesture interaction between the user and the 3D model in the 3D rendering engine includes:

[0023] Using the gesture addition method defined by the iOS system, add iOS system model interaction gestures to the 3D model;

[0024] Set the maximum number of fingers recognized by the model interaction gesture to 2 to facilitate two-finger swipe interaction between the user and the 3D model.

[0025] Optionally, in some optional implementations, setting the maximum finger index of the model interaction gesture recognition to 2, so that the user can perform two-finger sliding interaction with the 3D model, includes:

[0026] Set the maximum finger index of the model interactive gesture recognition to 2;

[0027] After obtaining the two-finger sliding data of the user on the screen coordinate system, converting the position of the 3D model from the 3D coordinate system scene to the screen coordinate system;

[0028] Calculate the final position of the 3D model in the screen coordinate system as the two fingers slide according to the position of the 3D model in the screen coordinate system and the X-axis offset distance and the Y-axis offset distance in the two-finger sliding data;

[0029] The final position of the 3D model in the screen coordinate system is converted to a corresponding position in the 3D coordinate system scene, so that the user can perform two-finger sliding interaction with the 3D model.

[0030] Optionally, in some optional implementations, adding a model interaction gesture to the 3D model to facilitate gesture interaction between the user and the 3D model in the 3D rendering engine includes:

[0031] Using the gesture adding method defined by the iOS system, adding a model interaction gesture of the iOS system to the 3D model;

[0032] The zoom size attribute of the 3D model is set equal to the product of the default zoom ratio of the model interaction gesture and the unified zoom ratio of each 3D model, so that the user can perform two-finger zoom interaction with the 3D model.

[0033] In a second aspect, a custom gesture interaction device on an iOS system includes: a camera interaction prohibition unit, a model position fixing unit, and an interaction gesture adding unit;

[0034] The camera interaction prohibition unit is used to fix the camera of the 3D rendering engine at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the imaging direction of the camera is the negative direction along the z-axis;

[0035] The model position fixing unit is used to fix the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented based on a SCNVector3 structure;

[0036] The interactive gesture adding unit is used to add a model interactive gesture to the 3D model to facilitate the user to perform gesture interaction with the 3D model in the 3D rendering engine.

[0037] In a third aspect, a computer-readable storage medium stores a program, which, when executed by a processor, implements any of the above-mentioned custom gesture interaction methods on an iOS system.

[0038] In a fourth aspect, an electronic device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute any of the above-mentioned custom gesture interaction methods on the iOS system.

[0039] By means of the above technical scheme, the present invention provides a method and related device for custom gesture interaction on an iOS system, which can fix the camera of a 3D rendering engine at the origin of a 3D coordinate system scene of an iOS system to prohibit the use of a camera interaction mode in the 3D rendering engine, wherein the direction of the camera imaging is along the negative direction of the z-axis; fix a 3D model at the first position of a 3D coordinate system scene with the camera as the origin to realize the imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented by a SCNVector3 structure; and add a model interaction gesture to the 3D model so that the user can perform gesture interaction with the 3D model in the 3D rendering engine. It can be seen from this that the present invention can redefine the position between the camera and the 3D model by disabling the camera interaction mode of the 3D rendering engine, and add a model interaction gesture to the 3D model, so that the interaction mode in the 3D rendering engine is transferred from the camera to the 3D model, and the user can perform gesture interaction with the 3D model, thereby ensuring the consistency of the interaction and state of the 3D model in any scene.

[0040] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0042] Figure 1 The flowchart of the first custom gesture interaction method provided by the present invention on the iOS system is shown;

[0043] Figure 2 The schematic diagram of the node structure of an SCNNode provided by the present invention is shown;

[0044] Figure 3 The flowchart of the second custom gesture interaction method provided by the present invention on the iOS system is shown;

[0045] Figure 4 The flowchart of the third custom gesture interaction method provided by the present invention on the iOS system is shown;

[0046] Figure 5 The flowchart of the fourth custom gesture interaction method provided by the present invention on the iOS system is shown;

[0047] Figure 6 The schematic diagram of the structure of a custom gesture interaction device provided by the present invention on the iOS system is shown;

[0048] Figure 7 The schematic diagram of the structure of an electronic device provided by the present invention is shown. Detailed implementation manners

[0049] When rendering a 3D model based on a 3D rendering engine on the iOS platform, the built-in model interaction implementation method of the system is camera-based interaction. When the camera rotates, it causes the rotation of the 3D coordinate system where the 3D model is located, which affects all nodes in the 3D coordinate system, resulting in the rotation of the position of the 3D model lamp tube node and causing problems such as the inconsistency between the model interaction gesture and the state of the 3D model.

[0050] Regarding Problem 1, the built-in interaction method of the 3D rendering engine of the iOS system is camera-based interaction. When the camera rotates, it causes the rotation of the entire 3D coordinate system, which affects all nodes in the 3D coordinate system, resulting in the rotation of the position of the model nodes and problems such as the inconsistency between the model interaction gesture and the state of the 3D model. The present invention realizes the transfer of the interaction method within the 3D rendering engine from the camera to the 3D model by disabling the built-in camera interaction method of the 3D rendering engine and adding a UIGestureRecognizer gesture to the 3D model.

[0051] For question 2, when the camera interaction is prohibited in the 3D rendering engine of the iOS system, the model does not support any interactive behavior. The present invention implements pinch-to-zoom by adding UIPinchGestureRecognizer to the 3D model itself, adds UIPanGestureRecognizer gesture to implement single-finger rotation and translation, and implements click home by UITapGestureRecognizer gesture.

[0052] Regarding question 3, the conflict between single-finger rotation and two-finger translation implemented by UIPanGestureRecognizer in the custom gestures of the model in the 3D rendering engine of the iOS system, and the conflict between UIPinchGestureRecognizer and UIPanGestureRecognizer during two-finger translation and scaling. The present invention solves the conflict between single-finger rotation and two-finger translation of the model by setting the number of fingers recognized by UIPanGestureRecognizer, and solves the conflict between scaling and translation of the model by simultaneously recognizing both UIPinchGestureRecognizer and UIPanGestureRecognizer during two-finger interaction.

[0053] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0054] like Figure 1 As shown, the present invention provides a custom gesture interaction method on an iOS system, including: S100, S200 and S300;

[0055] S100, fixing the camera of the 3D rendering engine at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the direction of the camera imaging is along the negative direction of the z-axis;

[0056] Optionally, the 3D coordinate system of the iOS system adopts a right-handed Cartesian coordinate system. The X-axis represents the horizontal position of the object, the Y-axis represents the vertical position of the object, and the Z-axis represents the depth position of the object, and the present invention does not limit this.

[0057] Optionally, the scene in the present invention refers to SCNScene, which provides a scene for 3D model rendering and display in the iOS system. The content that the 3D rendering engine (e.g., SceneKit engine) of the iOS system needs to render needs to be bound to SCNNode, which is defined as a node. The overall structure of each node is as follows: Figure 2 shown.

[0058] Optionally, the 3D rendering engine mentioned in the present invention is a well-known engine in the field of iOS systems, and the present invention will not make any detailed descriptions on this. For details, please refer to the relevant descriptions in the field.

[0059] S200, fixing the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented by a SCNVector3 structure;

[0060] Optionally, the iOS system creates a 3D coordinate system through SCNScene. When a node is added to the coordinate system, the position of the node is represented by three numbers. These three components are represented by the SCNVector3 (SCNVector3 defines three values: x, y and z. The corresponding values ​​are the X-axis, Y-axis and Z-axis in the 3D coordinate system) structure, which defines the position of the node on the x, y and z axes. The present invention no longer uses the camera interaction method of the 3D rendering engine. The camera is fixed at the origin of the entire scene in the 3D coordinate system, that is, SCNVector (0, 0, 0), and the direction of camera imaging is along the negative direction of the z axis. The 3D model (which can be a GLTF 3D model) is placed at the first position to achieve the imaging effect of the model.

[0061] Optionally, the first position mentioned in the present invention can be a position in the negative direction of the Z axis. Since the camera is fixed at the position of (0, 0, 0), facing the negative direction of the Z axis, the model must be set in the negative direction of the Z axis to form an image. For example, the model can be at the position of (0, 0, -2.6). Of course, the present invention is not limited to this position, and can be set according to actual needs. Generally speaking, the closer the position of the model is to the origin, the larger the model is; the farther the position of the model is from the origin, the smaller the model is, and the present invention does not limit this.

[0062] Optionally, the iOS system defaults to implementing model interaction behavior by adjusting the angle and position of the camera. The solution of the present invention does not adjust the position and angle of the camera, but modifies the position and angle of the model in real time. Therefore, the present invention needs to fix the camera position at the origin of the entire scene.

[0063] Optionally, the reason for placing the 3D model at the position of the first position in the present invention is that the position of the camera along the Z-axis is more conducive to the presentation of the model. As for whether the value on the Z-axis is -2.6, the present invention does not limit this, and corresponding adjustments can be made specifically according to parameters such as the focal length of the camera.

[0064] Optionally, in some alternative embodiments, after the S200, the method further includes: Step 1.1, Step 1.2, and Step 1.3;

[0065] Step 1.1, calculate the difference between the maximum bounding box and the minimum bounding box in each 3D model to obtain a vector size, where the vector size includes length, width, and height;

[0066] Optionally, the bounding box can be understood as a rectangular box, and the 3D model is placed in this rectangular box. Since different 3D models require boxes of different sizes. Therefore, the present invention can determine the maximum bounding box and the minimum bounding box from each bounding box, and then calculate the difference between the maximum bounding box and the minimum bounding box. It should be noted that: each bounding box has corresponding length, width, and height, and measuring the difference between two bounding boxes is to calculate the difference in length, the difference in width, and the difference in height. The present invention does not limit this.

[0067] For example, if the length, width, and height of the maximum bounding box are 10, 10, 5 respectively, and the length, width, and height of the minimum bounding box are 5, 4, 3 respectively, then the length, width, and height of the calculated vector size are 5 (10 - 5), 6 (10 - 4), 2 (5 - 3) respectively. The present invention does not limit this.

[0068] Step 1.2, determine the maximum value from the length, width, and height;

[0069] Step 1.3, place the 3D model in a bounding box with a vector size of 1 so that the scaling ratio of each 3D model is unified to 1 / maximum value.

[0070] Optionally, in order to ensure the consistency of the model size in the present invention, each 3D model needs to be placed in a bounding box of the same size, that is, a bounding box with a vector size of 1, so as to ensure that each 3D model looks the same size from the outside.

[0071] Optionally, since the 3D models are all scaled in a bounding box of unified size, therefore, the present invention needs to determine the scaling ratio of each 3D model scaled in the bounding box. Taking the above vector size with length, width, and height being 5, 6, 2 respectively as an example, the maximum value is 6, so the scaling ratio of the 3D model scaled in a bounding box with a vector size of 1 is 1 / 6. The present invention does not limit this.

[0072] S300. Add model interaction gestures to the 3D model to facilitate gesture interaction between the user and the 3D model in the 3D rendering engine.

[0073] For example, as Figure 3 shown, in some alternative embodiments, S300 includes: S310 and S311;

[0074] S310. Use the gesture addition method defined by the iOS system to add model interaction gestures of the iOS system to the 3D model;

[0075] Optionally, the model interaction gesture can be a sliding gesture defined by the iOS system API. In the present invention, this gesture can be added through the gesture addition method addGesture() defined by the iOS system. The added gesture can be: UIPanGestureRecognizer gesture, and the invention does not limit this.

[0076] S311. Set the maximum number of fingers recognized by the model interaction gesture to 1 to facilitate single-finger gesture interaction between the user and the 3D model.

[0077] Optionally, in some alternative embodiments, S311 includes: Step 2.1, Step 2.2, Step 2.3, Step 2.4, Step 2.5, and Step 2.6;

[0078] Step 2.1. Set the maximum number of fingers recognized by the model interaction gesture to 1;

[0079] Step 2.2. After obtaining the single-finger sliding data of the user in the screen coordinate system, calculate the rotation axis of the 3D model and the finger movement distance corresponding to the single-finger sliding data in the 3D model according to the X-axis offset distance and Y-axis offset distance in the single-finger sliding data;

[0080] Step 2.3. Calculate the rotation angle of the 3D model according to the finger movement distance;

[0081] Step 2.4. Calculate the rotation factor of the 3D model rotation according to the rotation angle of the 3D model;

[0082] Step 2.5. Obtain the quaternion of the single-finger sliding data in the 3D coordinate system scene according to the rotation axis, the angle, and the rotation factor;

[0083] Step 2.6. Control the 3D model to rotate based on the quaternion to achieve single-finger gesture interaction between the user and the 3D model.

[0084] Optionally, since the coordinate system for finger interaction is a 2D screen coordinate system, the present invention needs to convert the finger sliding data to a 3D coordinate system.

[0085] Optionally, define the offset distance of the finger sliding process on the X-axis as: distanceX (X-axis offset distance), and the offset distance on the Y-axis as: distanceY (Y-axis offset distance). Based on distanceX and distanceY, the present invention can calculate the rotation axis axis of the model as: SCNVector(-distanceY, -distanceX, 0), and the finger movement distance distance as: sqrt(distanceX × distanceX + distanceY × distanceY), and the present invention does not limit this.

[0086] Optionally, after calculating the above finger movement distance distance, the present invention can calculate the rotation angle angle of the model according to distance = distance × Double.pi / 180, where Double.pi is a definition of PI provided by the iOS system API, and Double.pi / 180 represents the radian, and the present invention does not limit this.

[0087] Optionally, after calculating the above angle angle, the present invention can calculate the rotation factor factor = sin(angle / 2) according to the angle angle, and the present invention does not limit this.

[0088] Optionally, the present invention can obtain the quaternion in the 3D coordinate system according to axis, angle and factor: SCNVector4(axis.x × factor, axis.y × factor, axis.z × factor, cos(angle / 2)). A quaternion is an extended complex number composed of a real part and an imaginary part. A quaternion can be expressed as q = w + xi + yj + zk, where w is the real part, and (x, y, z) are the components on the rotation axis corresponding to the imaginary part. The real part w represents the cosine value of the rotation angle, and the imaginary part (x, y, z) represents the product of the sine value of the rotation angle and the rotation axis. For example, in the quaternion q = cos(θ / 2) + u × sin(θ / 2), w = cos(θ / 2) represents the cosine value of the rotation angle, and (u × sin(θ / 2)) represents the product of the sine value of the rotation angle and the rotation axis. The model can rotate itself according to the quaternion to achieve single-finger sliding model rotation.

[0089] Another example is, as Figure 4 shown, in some optional embodiments, the S300 includes: S320 and S321;

[0090] S320. Add the model interaction gestures of the iOS system to the 3D model using the gesture addition method defined by the iOS system.

[0091] S321. Set the maximum number of fingers recognized for the model interaction gesture to 2 to facilitate two-finger sliding interaction between the user and the 3D model.

[0092] Optionally, in some alternative embodiments, S321 includes: Step 3.1, Step 3.2, Step 3.3, and Step 3.4.

[0093] Step 3.1. Set the maximum number of fingers recognized for the model interaction gesture to 2.

[0094] Step 3.2. After obtaining the two-finger sliding data of the user in the screen coordinate system, convert the position of the 3D model from the 3D coordinate system scene to the screen coordinate system.

[0095] Step 3.3. Calculate the final position of the 3D model in the screen coordinate system as it slides with two fingers based on the position of the 3D model in the screen coordinate system and the X-axis offset distance and Y-axis offset distance in the two-finger sliding data.

[0096] Step 3.4. Convert the final position of the 3D model in the screen coordinate system to the corresponding position in the 3D coordinate system scene to achieve two-finger sliding interaction between the user and the 3D model.

[0097] Optionally, the present invention can add model interaction gestures to the model (the added gestures can be: UIPanGestureRecognizer gestures), and at the same time set the maximum number of fingers recognized for the gesture to 2, then two-finger sliding interaction of the model can be achieved.

[0098] Optionally, the offset distance in the X-axis during the two-finger sliding is: distanceX (X-axis offset distance), and the offset distance in the Y-axis is: distanceY (Y-axis offset distance). The present invention first converts the position of the model from the 3D coordinate system to the 2D screen coordinate system. That is: nodeScreenPosition = projectPoint(node.position), where the projectPoint method is a method defined by the iOS system, and the present invention does not describe it in detail. For specific details, please refer to the relevant descriptions in the art.

[0099] Optionally, the present invention can calculate the final position of the node in the 2D coordinate system based on the position of the node in the 2D screen coordinate system and the offset distance.

[0100] That is, nodeScreenPosition = SCNVector3(nodeScreenPosition.x - distanceX, nodeScreenPosition.y - distanceY, nodeScreenPosition.z). It should be noted that: the position of the 3D model in the screen coordinate system, plus the offset distance of the finger in the screen coordinate system each time, gives the real-time position of the 3D model along with the finger in the screen coordinate system. The present invention places no restrictions on this.

[0101] Finally, the present invention converts the position of the node in the 2D screen coordinate system into the position in the 3D coordinate system. That is, nodeScenePosition = unprojectPoint(nodeScreenPosition), where the unprojectPoint method is a method defined by the iOS system. The present invention will not describe it in detail here. For specific details, please refer to the relevant descriptions in the art.

[0102] For another example, as Figure 5 shown, in some alternative embodiments, S300 includes: S330 and S331;

[0103] S330, using the gesture addition method defined by the iOS system, adds the model interaction gesture of the iOS system to the 3D model;

[0104] S331, sets the scaling size attribute of the 3D model to be equal to the product of the default scaling ratio of the model interaction gesture and the unified scaling ratio of each 3D model, so as to facilitate the user to perform two-finger scaling interaction with the 3D model.

[0105] Optionally, the present invention can add a model interaction gesture to the model (the added gesture can be: UIPinchGestureRecognizer gesture), and then the two-finger scaling interaction of the model can be realized.

[0106] Optionally, the present invention only needs to multiply the scaling of the finger by the scaling of the model itself to obtain the final scaling size of the model. That is: scale = gesture.scale × node.currentScale, that is, multiplying the current scaling size of the model by the scaling size according to the gesture is the final scaling size to be displayed by the model.

[0107] Optionally, the present invention finally achieves the effect of model scaling by setting the model scale attribute, that is, node.scale = SCNVector3 (scale, scale, scale). It should be noted that SCNVector3 three-dimensional vector represents the scaling of the 3D model on the three axes of X, Y and Z. The same value scale is used here to ensure that the scaling of the 3D model will not be deformed, and the present invention does not limit this.

[0108] like Figure 6 As shown, the present invention provides a custom gesture interaction device on an iOS system, comprising: a camera interaction prohibition unit 100, a model position fixing unit 200, and an interaction gesture adding unit 300;

[0109] The camera interaction prohibition unit 100 is used to fix the camera of the 3D rendering engine at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the imaging direction of the camera is along the negative direction of the z-axis;

[0110] The model position fixing unit 200 is used to fix the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented by a SCNVector3 structure;

[0111] The interactive gesture adding unit 300 is used to add a model interactive gesture to the 3D model, so as to facilitate the user to perform gesture interaction with the 3D model in the 3D rendering engine.

[0112] Optionally, in certain optional embodiments, the device further comprises: a vector size obtaining unit, a maximum value determining unit and a model reduction placement unit;

[0113] The vector size obtaining unit is used to calculate the difference between the maximum bounding box and the minimum bounding box in each 3D model after fixing the 3D model at the first position of the 3D coordinate system scene with the camera as the origin, so as to obtain a vector size, wherein the vector size includes length, width and height;

[0114] The maximum value determining unit is used to determine the maximum value from the length, width and height;

[0115] The model reduction placement unit is used to place the 3D model in a bounding box with a vector size of 1, so that the scaling ratio of each 3D model is unified to 1 / maximum value.

[0116] Optionally, in some alternative embodiments, the interaction gesture adding unit 300 includes: a first gesture adding subunit and a first gesture setting subunit;

[0117] The first gesture adding subunit is configured to use the gesture adding method defined by the iOS system to add the model interaction gesture of the iOS system to the 3D model;

[0118] The first gesture setting subunit is configured to set the maximum number of fingers recognized by the model interaction gesture to 1, so as to facilitate the user to perform single-finger gesture interaction with the 3D model.

[0119] Optionally, in some alternative embodiments, the first gesture setting subunit includes: a first finger number setting subunit, a first moving distance calculating subunit, an angle calculating subunit, a rotation factor calculating subunit, a quaternion determining subunit, and a single-finger interaction subunit;

[0120] The first finger number setting subunit is configured to set the maximum number of fingers recognized by the model interaction gesture to 1;

[0121] The first moving distance calculating subunit is configured to, after obtaining the single-finger sliding data of the user in the screen coordinate system, calculate the rotation axis of the 3D model and the finger moving distance corresponding to the single-finger sliding data in the 3D model according to the X-axis offset distance and the Y-axis offset distance in the single-finger sliding data;

[0122] The angle calculating subunit is configured to calculate the rotation angle of the 3D model according to the finger moving distance;

[0123] The rotation factor calculating subunit is configured to calculate the rotation factor of the 3D model rotation according to the rotation angle of the 3D model;

[0124] The quaternion determining subunit is configured to obtain the quaternion of the single-finger sliding data in the 3D coordinate system scene according to the rotation axis, the angle, and the rotation factor;

[0125] The single-finger interaction subunit is configured to control the 3D model to rotate based on the quaternion, so as to realize the single-finger gesture interaction between the user and the 3D model.

[0126] Optionally, in some alternative embodiments, the interaction gesture adding unit 300 includes: a second gesture adding subunit and a second gesture setting subunit;

[0127] The second gesture adding subunit is configured to use the gesture adding method defined by the iOS system to add the model interaction gesture of the iOS system to the 3D model;

[0128] The second gesture setting subunit is configured to set the maximum number of fingers recognized for the model interaction gesture to 2, so as to facilitate the user to perform two-finger sliding interaction with the 3D model.

[0129] Optionally, in some alternative embodiments, the second gesture setting subunit includes: a second finger number setting subunit, a coordinate system conversion subunit, a final position calculation subunit, and a two-finger sliding interaction subunit;

[0130] The second finger number setting subunit is configured to set the maximum number of fingers recognized for the model interaction gesture to 2;

[0131] The coordinate system conversion subunit is configured to, after obtaining the two-finger sliding data of the user in the screen coordinate system, convert the position of the 3D model from the 3D coordinate system scene to the screen coordinate system;

[0132] The final position calculation subunit is configured to calculate the final position of the 3D model in the screen coordinate system along with the two-finger sliding according to the position of the 3D model in the screen coordinate system and the X-axis offset distance and Y-axis offset distance in the two-finger sliding data;

[0133] The two-finger sliding interaction subunit is configured to convert the final position of the 3D model in the screen coordinate system to the corresponding position in the 3D coordinate system scene, so as to implement the two-finger sliding interaction between the user and the 3D model.

[0134] Optionally, in some alternative embodiments, the interaction gesture adding unit 300 includes: a third gesture adding subunit and a scaling attribute setting subunit;

[0135] The third gesture adding subunit is configured to use the gesture adding method defined by the iOS system to add the model interaction gesture of the iOS system to the 3D model;

[0136] The scaling attribute setting subunit is configured to set the scaling size attribute of the 3D model to be equal to the product of the default scaling ratio of the model interaction gesture and the unified scaling ratio of each 3D model, so as to facilitate the user to perform two-finger scaling interaction with the 3D model.

[0137] The present invention provides a computer-readable storage medium, on which a program is stored, and when the program is executed by a processor, the custom gesture interaction method on the iOS system described in any one of the above is implemented.

[0138] As Figure 7As shown, the present invention provides an electronic device 70, which includes at least one processor 701, at least one memory 702 connected to the processor 701, and a bus 703. Among them, the processor 701 and the memory 702 communicate with each other through the bus 703. The processor 701 is used to call program instructions in the memory 702 to execute the custom gesture interaction method on the iOS system described in any one of the above.

[0139] In the present invention, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or device including the element.

[0140] Each embodiment in this specification is described in a related manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

[0141] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined in the present invention can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to these embodiments shown in the present invention, but will conform to the widest scope consistent with the principles and novel features disclosed in the present invention.

[0142] The above is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A custom gesture interaction method on iOS system, characterized in that: include: The camera of the 3D rendering engine is fixed at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the imaging direction of the camera is along the negative direction of the z-axis; Fixing the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented based on the SCNVector3 structure; Using the gesture adding method defined by the iOS system, the model interaction gesture of the iOS system is added to the 3D model, so that the user can perform gesture interaction with the 3D model in the 3D rendering engine.

2. The method according to claim 1, characterized in that After fixing the 3D model at a first position of a 3D coordinate system scene with the camera as an origin, the method further includes: Calculate the difference between the maximum bounding box and the minimum bounding box in each 3D model to obtain a vector size, wherein the vector size includes a length, a width, and a height; determining a maximum value from among said length, width and height; The 3D models are placed in a bounding box with a vector size of 1, so that the scaling ratio of each of the 3D models is unified to 1 / maximum value.

3. The method according to claim 1, characterized in that The maximum finger index for the model interaction gesture recognition is set to 1, so that the user can perform single-finger gesture interaction with the 3D model.

4. The method according to claim 3, characterized in that The step of setting the maximum finger index of the model interaction gesture recognition to 1, so as to facilitate the user to perform single-finger gesture interaction with the 3D model, includes: Set the maximum finger index of the model interactive gesture recognition to 1; After obtaining the single-finger sliding data of the user on the screen coordinate system, calculating the rotation axis of the 3D model and the finger movement distance corresponding to the single-finger sliding data in the 3D model according to the X-axis offset distance and the Y-axis offset distance in the single-finger sliding data; Calculating the rotation angle of the 3D model according to the finger movement distance; Calculating a rotation factor of the 3D model according to the rotation angle of the 3D model; Obtaining a quaternion of the single-finger sliding data in the 3D coordinate system scene according to the rotation axis, the angle, and the rotation factor; The 3D model is controlled to rotate based on the quaternion, so that the user can interact with the 3D model through a single-finger gesture.

5. The method according to claim 1, characterized in that: The maximum finger index for the model interaction gesture recognition is set to 2, so that the user can perform two-finger sliding interaction with the 3D model.

6. The method according to claim 5, characterized in that The step of setting the maximum finger index of the model interaction gesture recognition to 2 so as to facilitate the user to perform two-finger sliding interaction with the 3D model includes: Set the maximum finger index of the model interactive gesture recognition to 2; After obtaining the two-finger sliding data of the user on the screen coordinate system, converting the position of the 3D model from the 3D coordinate system scene to the screen coordinate system; Calculate the final position of the 3D model in the screen coordinate system as the two fingers slide according to the position of the 3D model in the screen coordinate system and the X-axis offset distance and the Y-axis offset distance in the two-finger sliding data; The final position of the 3D model in the screen coordinate system is converted to a corresponding position in the 3D coordinate system scene, so that the user can perform two-finger sliding interaction with the 3D model.

7. The method according to claim 2, characterized in that The zoom size attribute of the 3D model is set equal to the product of the default zoom ratio of the model interaction gesture and the unified zoom ratio of each 3D model, so that the user can perform two-finger zoom interaction with the 3D model.

8. A custom gesture interaction device on an iOS system, characterized in that: include: Camera interaction prohibition unit, model position fixing unit and interaction gesture adding unit; The camera interaction prohibition unit is used to fix the camera of the 3D rendering engine at the origin of the 3D coordinate system scene of the iOS system to prohibit the use of the camera interaction mode in the 3D rendering engine, wherein the imaging direction of the camera is the negative direction along the z-axis; The model position fixing unit is used to fix the 3D model at a first position of a 3D coordinate system scene with the camera as the origin, so as to realize imaging of the 3D model in the 3D coordinate system scene, wherein the first position is a coordinate represented based on a SCNVector3 structure; The interactive gesture adding unit is used to use the gesture adding method defined by the iOS system to add the model interactive gesture of the iOS system to the 3D model, so that the user can perform gesture interaction with the 3D model in the 3D rendering engine.

9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by the processor, the custom gesture interaction method on the iOS system is implemented as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the custom gesture interaction method on the iOS system as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Gesture interaction device and method for 360-degree suspension type light field three-dimensional display system

    CN110865704A

  • Handheld mobile terminal control method and related apparatus

    CN113056718A