Model control method, device, medium and equipment
By calculating the spatial coordinates of the auxiliary control body and the model, the synchronous movement of the model in 3D scenes is achieved, solving the problems of user freedom limitation and misoperation, and improving the authenticity and accuracy of dragging.
Patent Information
- Application Number
- CN202210268421.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-18
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2042-03-18
AI Technical Summary
The existing model control method in 3D scenes limits the user's degree of freedom, and it is easy to cause malfunctioning due to fingers or stylus when dragging the model on a small screen device.
By obtaining the coordinates of the touch point on the screen, calculating the spatial coordinates of the auxiliary control body, and calculating the spatial coordinates of the model based on the preset distance relationship, thereby realizing the synchronous movement of the auxiliary control body and the model.
It realizes the authenticity and accuracy of the user dragging the model with maximum freedom, avoids misoperation caused by occlusion, and improves the entertainment and experience in 3D scenes.
Smart Images

Figure CN114733192B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer vision, and in particular relates to a model control method, device, medium and equipment. Background Art
[0002] With the development of science and technology, more and more novel things are appearing in people's daily lives, making people's life and entertainment more fulfilling. This includes game entertainment in 3D scenes. At present, most models in 3D scenes are controlled by three-dimensional coordinate axes. Each time, they are moved according to the coordinate axes or directly by pressing the model. This method requires users to move the model under limited rules, such as limiting the range of movement, or only being able to move in a specific direction or angle, etc., which does not give users greater freedom to design and place models. In addition, for smaller mobile phone screens, if you press the model directly to move it, your fingers or stylus will block the model, which is not conducive to the user's observation of the model's location, and will cause misoperation, greatly reducing the entertainment and experience. Summary of the invention
[0003] In order to overcome the above-mentioned defects in the prior art, the present invention provides a model control method, device, medium and equipment.
[0004] A first aspect of an embodiment of the present invention provides a model control method, the method comprising:
[0005] Get the coordinates of the touch point on the screen;
[0006] Obtaining the spatial coordinates of the auxiliary control body according to the coordinates of the touch point on the screen and the spatial coordinates of the virtual camera;
[0007] Obtaining the spatial coordinates of the model corresponding to the auxiliary control body according to the spatial coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model;
[0008] The auxiliary control volume and the model are displayed according to the spatial coordinates of the auxiliary control volume and the spatial coordinates of the model.
[0009] Preferably, the process of obtaining the spatial coordinates of the auxiliary control body according to the touch point coordinates on the screen and the spatial coordinates of the virtual camera includes:
[0010] Converting the touch point coordinates on the screen into coordinates in the 3D scene;
[0011] Obtain the first straight line equation in space according to the spatial coordinates of the virtual camera and the direction vector of the coordinates of the touch point in the 3D scene;
[0012] Obtaining a first plane equation in space according to the initial screen coordinates of the auxiliary control body and a positive normal vector along the Z axis of the initial screen coordinates of the auxiliary control body;
[0013] The coordinates of the intersection of the straight line in the first straight line equation and the plane in the first plane equation are obtained according to the first straight line equation in space and the first plane equation in space, and the coordinates of the intersection are the spatial coordinates of the auxiliary control body.
[0014] Preferably, the process of obtaining the spatial coordinates of the model corresponding to the auxiliary control body according to the spatial coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model comprises:
[0015] Converting the spatial coordinates of the auxiliary control body into screen coordinates;
[0016] Obtaining the screen coordinates of the model according to the screen coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model;
[0017] Convert the screen coordinates of the model into coordinates in the 3D scene;
[0018] Obtaining a second straight line equation in space according to the coordinates of the model in the 3D scene and the spatial coordinates of the virtual camera;
[0019] Obtaining a second spatial plane equation according to the spatial coordinates of the auxiliary control body and the direction vector along the forward direction of the virtual camera as a normal vector;
[0020] The coordinates of the intersection of the straight line in the second straight line equation and the plane in the second plane equation are obtained according to the second straight line equation in space and the second plane equation in space, and the intersection coordinates are the spatial coordinates of the model.
[0021] Preferably, the method further comprises:
[0022] Obtaining a target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen;
[0023] An auxiliary control body corresponding to the target display range is displayed on the screen.
[0024] Preferably, the process of obtaining the target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and the preset display range of the auxiliary control body on the screen comprises:
[0025] Converting the spatial coordinates of the auxiliary control body into screen coordinates;
[0026] Obtaining the coordinates of a point on the circle in the X-axis direction of the auxiliary control body according to the screen coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen;
[0027] Convert the coordinates of the points on the circle in the X-axis direction of the auxiliary control body into coordinates in the 3D scene, and obtain the equation of the third straight line in space according to the coordinates of the points on the circle in the X-axis direction of the auxiliary control body in the 3D scene and the spatial coordinates of the virtual camera;
[0028] Obtaining a third plane equation in space according to the spatial coordinates of the auxiliary control body and the direction vector along the forward direction of the virtual camera as a normal vector;
[0029] Obtaining the coordinates of the intersection of the straight line in the third spatial straight line equation and the plane in the third spatial plane equation according to the third spatial straight line equation and the third spatial plane equation;
[0030] The target display range of the auxiliary control body in space is obtained according to the intersection coordinates and the spatial coordinates of the auxiliary control body.
[0031] Preferably, the auxiliary control body is a symmetrical figure, and the radius of the circle where the point on the circle is located is the maximum distance from the center point to the end point of the auxiliary control body in the preset display range.
[0032] Preferably, the auxiliary control body is an asymmetric figure, and the radius of the circle where the point on the circle is located is half of the maximum distance between the two endpoints of the auxiliary control body in the preset display range.
[0033] A second aspect of an embodiment of the present invention provides a model control device, the device comprising:
[0034] A screen coordinate acquisition module is used to obtain the coordinates of the touch point on the screen;
[0035] An auxiliary control body space coordinate calculation module, used to obtain the space coordinates of the auxiliary control body according to the touch point coordinates on the screen and the space coordinates of the virtual camera;
[0036] A model space coordinate calculation module, used for obtaining the space coordinate of the model corresponding to the auxiliary control body according to the space coordinate of the auxiliary control body and the preset distance between the auxiliary control body and the model;
[0037] A display module is used to display the auxiliary control body and the model according to the spatial coordinates of the auxiliary control body and the spatial coordinates of the model.
[0038] A third aspect of an embodiment of the present invention provides one or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, enable the one or more computer devices to execute the model control method as described in the first aspect of the embodiment of the present invention.
[0039] A fourth aspect of an embodiment of the present invention provides a computer device, the computer device comprising a memory and a processor, wherein:
[0040] The memory stores a computer program, and when the processor executes the computer program, the model control method as described in the first aspect of the embodiment of the present invention is implemented.
[0041] The model control method provided by the present invention binds the auxiliary control body and the model in the 3D scene, and obtains the spatial coordinates of the model through the spatial coordinate calculation of the auxiliary control body. In this way, when the position of the auxiliary control body changes, the position of the corresponding model will also change synchronously, thereby realizing that while the user is controlling the auxiliary control body, the model can also move with the movement of the auxiliary control body. At the same time, since the present invention does not have any operation to define the coordinate system and the dragging rules during the model dragging process, the auxiliary control body and the model are completely free of any constraints during the movement process, and the model can be dragged with the maximum degree of freedom, so that the dragging process of the model more realistically reflects the user's operation and enhances the authenticity of the model dragging. In addition, since the auxiliary control body and the model are separated by a certain distance, during the model dragging process, the model is always outside the touch point on the screen, and will not cause occlusion. The user can drag the model to the desired position more easily and accurately to avoid the occurrence of misoperation. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0043] Figure 1 This is a flow chart of the model control method described in Example 1 of the present invention;
[0044] Figure 2 and Figure 3 It is a schematic diagram of the positions of the auxiliary control bodies and models in the 3D scene;
[0045] Figure 4 It is a schematic diagram of the direction vector of the virtual camera forward;
[0046] Figure 5 is a schematic diagram of the structure of a computer device according to Embodiment 4 of the present invention;
[0047] Figure 6It is a schematic diagram of the structure of a typical computer device for executing a specific implementation of the model control method of the present invention.
[0048] Reference numerals:
[0049] 1. Auxiliary control body, 2. Model. DETAILED DESCRIPTION
[0050] In order to better understand and explain the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings. The present invention is not limited to these specific embodiments. On the contrary, modifications or equivalent substitutions made to the present invention should all be included in the scope of the claims of the present invention.
[0051] It should be noted that numerous specific details are given in the following specific embodiments. Those skilled in the art should understand that the present invention can also be implemented without these specific details. In the multiple specific embodiments given below, the principles, structures and components well known in the art are not described in detail in order to highlight the main purpose of the present invention.
[0052] Example 1
[0053] like Figure 1 As shown, this embodiment proposes a model control method, which includes:
[0054] S101, obtaining the coordinates of the touch point on the screen;
[0055] S102: Obtaining the spatial coordinates of the auxiliary control body according to the touch point coordinates on the screen and the spatial coordinates of the virtual camera.
[0056] Specifically, the model control method proposed in this embodiment can be executed by a computer device, wherein the computer device can be a terminal or a server. The terminal can be a terminal device such as a smart phone, a tablet computer, a laptop, a touch screen, a personal computer (PC), a personal digital assistant (PDA), etc. The terminal can also include a client. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0057] In this embodiment, the coordinates of the touch point on the screen are first obtained, and then the spatial coordinates of the auxiliary control body are obtained according to the coordinates and the spatial coordinates of the virtual camera. Figure 2and Figure 3 As shown, the user can control the movement of the auxiliary control body to drive the model to change its position in the 3D scene.
[0058] More specifically, in this embodiment, the coordinates of the touch point on the screen can be obtained based on the characteristics of the screen itself (capacitive screen, infrared screen, etc. can calculate the position coordinates of the object on its screen) or by using other acquisition devices that can calculate the position of the touch point on the screen (image acquisition device for image analysis, etc.). At the same time, the touch point can be realized by an object or device that can realize touch operation on the screen, such as a touch point or a stylus. This embodiment is not particularly limited. The virtual camera can be understood as a virtual device that observes the model from different perspectives at a fixed point in space.
[0059] After acquiring the coordinates of the touch point on the screen, this embodiment converts the coordinates into the coordinates of the touch point in the 3D scene. The coordinate conversion method can be implemented by using the existing technology familiar to those skilled in the art, and this embodiment will not be described in detail. The equation of the first straight line in space is obtained according to the spatial coordinates of the virtual camera and the direction vector of the coordinates of the touch point in the 3D scene. For example, assuming that the coordinates of the touch point in the 3D scene are (x0, y0, z0) and the spatial coordinates of the virtual camera are (x1, y1, z1), the equation of the first straight line in space is:
[0060]
[0061] The equation of the first plane in space is obtained according to the initial screen coordinates of the auxiliary control body (the original position of the auxiliary control body) and the positive normal vector along the initial screen coordinates Z axis of the auxiliary control body. For example, assuming that the initial screen coordinates of the auxiliary control body are (x2, y2, z2), and the positive normal vector along the initial screen coordinates Z axis of the auxiliary control body is (0, 0, 1), then the equation of the first plane in space is (z-z2=0).
[0062] According to the equation of the first straight line in space and the equation of the first plane in space, the coordinates of the intersection of the straight line in the first straight line equation in space and the plane in the first plane equation in space are calculated, and the coordinates of the intersection are the spatial coordinates of the auxiliary control body. For example, assuming that the coordinates of the intersection are (x3, y3, z3), then:
[0063]
[0064]
[0065] z3=z2
[0066] S103: Obtain the spatial coordinates of the model corresponding to the auxiliary control body according to the spatial coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model.
[0067] Specifically, in this embodiment, after obtaining the spatial coordinates of the auxiliary control body, the spatial coordinates of the auxiliary control body are converted to screen coordinates. For example, the screen coordinates of the auxiliary control body after conversion are (x4, y4). According to the pre-set distance between the auxiliary control body and the model on the screen as f, it can be concluded that the screen coordinates of the model on the screen are (x4+f, y4). The screen coordinates of the model are converted into a 3D scene, and the coordinates of the model in the 3D scene are obtained, which are assumed to be (x8, y8, z8). The equation of the second straight line in space can be obtained based on the spatial coordinates of the virtual camera:
[0068]
[0069] The equation of the second plane in space can be obtained based on the spatial coordinates of the auxiliary control body and the direction vector along the virtual camera as the normal vector:
[0070] x6(x-x3)+y6(y-y3)+z6(z-z3)=0
[0071] Among them, Figure 4 As shown, the forward direction vector of the virtual camera is (x6, y6, z6).
[0072] According to the second line equation and the second plane equation, the coordinates of the intersection of the line in the second line equation and the plane in the second plane equation can be calculated. The coordinates of the intersection are the spatial coordinates of the model. For example, assuming that the coordinates of the intersection are (x9, y9, z9), then:
[0073] x9=x8+t(x8-x1)
[0074] y9=y8+t(y8-y1)
[0075] z9=z8+t(z8-z1)
[0076] Where t is:
[0077]
[0078] S104. Display the auxiliary control body and the model according to the spatial coordinates of the auxiliary control body and the spatial coordinates of the model.
[0079] After the spatial coordinates of the auxiliary control body and the spatial coordinates of the model are obtained through the above process, the auxiliary control body and the model can be displayed in the space of the screen. Since the spatial coordinates of the model are obtained from the spatial coordinates of the auxiliary control body, when the spatial coordinates of the auxiliary control body change, the spatial coordinates of the corresponding model will also change, thereby enabling the user to operate the auxiliary control body to move, and the model will also move with the movement of the auxiliary control body.
[0080] Furthermore, the method proposed in this embodiment also includes:
[0081] Obtaining a target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen;
[0082] An auxiliary control body corresponding to the target display range is displayed on the screen.
[0083] Specifically, after obtaining the spatial coordinates of the auxiliary control body, the spatial coordinates of the auxiliary control body are converted into screen coordinates, for example, the screen coordinates of the auxiliary control body after conversion are (x4, y4). According to the preset maximum distance from the center point of the auxiliary control body to the end point in the preset display range of the auxiliary control body on the screen, assuming that the maximum distance is R, the coordinates of the point on the circle in the X-axis direction of the auxiliary control body can be obtained as (x4+R, y4). Among them, the radius of the circle where the point on the circle is located is the preset maximum distance from the center point of the auxiliary control body to the end point in the preset display range of the auxiliary control body on the screen. It should be noted here that, in this embodiment, the auxiliary control body can be a symmetrical figure or an asymmetrical figure. For symmetrical figures, the radius of the circle where the point on the circle is located is the maximum distance from the center point of the auxiliary control body to the end point in the preset display range. For asymmetrical figures, the radius of the circle where the point on the circle is located is half of the distance between the two farthest end points of the auxiliary control body in the preset display range. Then the coordinates of the point on the circle are converted into coordinates in the 3D scene, assuming (x5, y5, z5). According to the spatial coordinates of the virtual camera, the equation of the third straight line in space can be obtained:
[0084]
[0085] The equation of the third plane in space can be obtained based on the spatial coordinates of the auxiliary control body and the direction vector along the virtual camera as the normal vector:
[0086] x6(x-x3)+y6(y-y3)+z6(z-z3)=0
[0087] Among them, the forward direction vector of the virtual camera is (x6, y6, z6).
[0088] According to the third line equation in space and the third plane equation in space, the coordinates of the intersection of the line in the third line equation in space and the plane in the third plane equation in space are obtained. Assuming that the coordinates of the intersection are (x7, y7, z7), then:
[0089] x7=x5+t(x5-x1)
[0090] y7=y5+t(y5-y1)
[0091] z7=z5+t(z5-z1)
[0092] Where t is:
[0093]
[0094] Finally, the radius of the auxiliary control body in space is calculated based on the coordinates of the intersection point and the spatial coordinates of the auxiliary control body. This radius is the target display range of the auxiliary control body in space:
[0095]
[0096] This embodiment calculates the target display range of the auxiliary control body in space during the movement of the auxiliary control body, and can adjust the size of the auxiliary control body displayed in the screen space at any time according to the moving position of the auxiliary control body, thereby providing users with a better visual experience.
[0097] The model control method provided in this embodiment binds the auxiliary control body and the model in the 3D scene, and obtains the spatial coordinates of the model through the spatial coordinate calculation of the auxiliary control body. In this way, when the position of the auxiliary control body changes, the position of the corresponding model will also change synchronously, thereby realizing that while the user is controlling the auxiliary control body, the model can also move with the movement of the auxiliary control body. At the same time, since the present invention does not have any operation to define the coordinate system and dragging rules during the process of dragging the model, the auxiliary control body and the model are completely free of any constraints during the movement process, and the model can be dragged with the maximum degree of freedom, so that the dragging process of the model more realistically reflects the user's operation and enhances the authenticity of the model dragging. In addition, since there is a certain distance between the auxiliary control body and the model, during the process of dragging the model, the model is always outside the touch point on the screen, and will not cause occlusion. The user can drag the model to the desired position more easily and accurately to avoid misoperation.
[0098] In addition, it should be noted that although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be changed in the order of execution. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
[0099] Example 2
[0100] Corresponding to Embodiment 1, this embodiment proposes a model control device, the device comprising:
[0101] A screen coordinate acquisition module is used to obtain the coordinates of the touch point on the screen;
[0102] An auxiliary control body space coordinate calculation module, used to obtain the space coordinates of the auxiliary control body according to the touch point coordinates on the screen and the space coordinates of the virtual camera;
[0103] A model space coordinate calculation module, used for obtaining the space coordinate of the model corresponding to the auxiliary control body according to the space coordinate of the auxiliary control body and the preset distance between the auxiliary control body and the model;
[0104] A display module is used to display the auxiliary control body and the model according to the spatial coordinates of the auxiliary control body and the spatial coordinates of the model.
[0105] Specifically, the auxiliary control volume space coordinate calculation module includes:
[0106] A first coordinate conversion submodule, used to convert the touch point coordinates on the screen into coordinates in the 3D scene;
[0107] A spatial first straight line equation calculation submodule, used to obtain the spatial first straight line equation according to the spatial coordinates of the virtual camera and the direction vector of the coordinates of the touch point in the 3D scene;
[0108] A spatial first plane equation calculation submodule, used for obtaining a spatial first plane equation according to the initial screen coordinates of the auxiliary control body and a positive normal vector along the initial screen coordinates Z axis of the auxiliary control body;
[0109] The auxiliary control body space coordinate calculation submodule is used to obtain the intersection coordinates of the straight line in the space first straight line equation and the plane in the space first plane equation according to the space first straight line equation and the space first plane equation, and the intersection coordinates are the space coordinates of the auxiliary control body.
[0110] The model space coordinate calculation module includes:
[0111] A second coordinate conversion submodule, used for converting the space coordinates of the auxiliary control body into screen coordinates;
[0112] A model screen coordinate calculation submodule, used to obtain the screen coordinates of the model according to the screen coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model;
[0113] A third coordinate conversion submodule, used for converting the screen coordinates of the model into coordinates in the 3D scene;
[0114] A spatial second straight line equation submodule, used to obtain the spatial second straight line equation according to the coordinates of the model in the 3D scene and the spatial coordinates of the virtual camera;
[0115] A spatial second plane equation submodule, used for obtaining a spatial second plane equation according to the spatial coordinates of the auxiliary control body and a direction vector along the forward direction of the virtual camera as a normal vector;
[0116] The model space coordinate calculation submodule is used to obtain the intersection coordinates of the straight line in the second straight line equation and the plane in the second plane equation according to the second straight line equation in the space and the second plane equation in the space, and the intersection coordinates are the space coordinates of the model.
[0117] Furthermore, the model control device proposed in this embodiment also includes:
[0118] The auxiliary control body space range calculation module is used to obtain the target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and the preset display range of the auxiliary control body on the screen;
[0119] The display module is used to display the auxiliary control body corresponding to the target display range on the screen.
[0120] Specifically, the auxiliary control volume space range calculation module includes:
[0121] A fourth coordinate conversion submodule, used for converting the space coordinates of the auxiliary control body into screen coordinates;
[0122] A submodule for calculating the coordinates of a point on a circle, for obtaining the coordinates of a point on a circle in the X-axis direction of the auxiliary control body according to the screen coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen, wherein the radius of the circle where the point on the circle is located is the maximum distance from the center point to the end point of the auxiliary control body in the preset display range;
[0123] A spatial third straight line equation calculation submodule is used to convert the coordinates of the points on the circle in the X-axis direction of the auxiliary control body into coordinates in the 3D scene, and obtain the spatial third straight line equation according to the coordinates of the points on the circle in the X-axis direction of the auxiliary control body in the 3D scene and the spatial coordinates of the virtual camera;
[0124] A spatial third plane equation calculation submodule, used for obtaining a spatial third plane equation according to the spatial coordinates of the auxiliary control body and a direction vector along the forward direction of the virtual camera as a normal vector;
[0125] An intersection coordinate calculation submodule, used for obtaining the intersection coordinates of the straight line in the third spatial straight line equation and the plane in the third spatial plane equation according to the third spatial straight line equation and the third spatial plane equation;
[0126] The auxiliary control body space range calculation submodule is used to obtain the target display range of the auxiliary control body in space according to the intersection coordinates and the space coordinates of the auxiliary control body.
[0127] This embodiment binds the auxiliary control body and the model in the 3D scene, and obtains the spatial coordinates of the model through the spatial coordinate calculation of the auxiliary control body. In this way, when the position of the auxiliary control body changes, the position of the corresponding model will also change synchronously, thereby realizing that while the user is controlling the auxiliary control body, the model can also move with the movement of the auxiliary control body. At the same time, since the present invention does not have any operation to define the coordinate system and dragging rules during the process of dragging the model, the auxiliary control body and the model are completely free of any constraints during the movement process, and the model can be dragged with the maximum degree of freedom, so that the dragging process of the model more realistically reflects the user's operation and enhances the authenticity of the model dragging. In addition, since there is a certain distance between the auxiliary control body and the model, during the process of dragging the model, the model is always outside the touch point on the screen, and will not cause occlusion. The user can drag the model to the desired position more easily and accurately to avoid misoperation.
[0128] Example 3
[0129] Corresponding to Example 1, this embodiment proposes one or more computer-readable media storing computer executable instructions, which, when used by one or more computer devices, enable one or more computer devices to execute the model control method as described in Example 1. The computer-readable medium can be any available medium that can be accessed by a computer device, and includes volatile and non-volatile media, removable and non-removable media implemented by any method and technology to store information such as computer-readable instructions, data structures, program modules or other data. Computer-readable media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store the required information and can be accessed by a computing device. Any combination of the above should also be included in the scope of computer-readable media.
[0130] Example 4
[0131] Corresponding to Embodiment 1, this embodiment proposes a computer device. Figure 5 As shown, the computer device 30 includes a memory 301 and a processor 302, wherein: the memory 301 stores a computer program, and the processor 302 implements the model control method as described in Example 1 when executing the computer program. The memory 301 and the processor 302 can be connected via a bus.
[0132] Please refer to Figure 6 , Figure 6 5 is a schematic diagram of a typical computer device for executing a specific embodiment of the model control method of the present invention. More specifically, each automation device for executing the model control method described above can be included as a part of the computer device. The computer device at least includes the following parts: CPU (central processing unit) 501, RAM (random access memory) 502, ROM (read-only memory) 503, system bus 500, hard disk control unit 504, hard disk 505, human-computer interaction external device control unit 506, human-computer interaction external device 507, serial interface control unit 508, serial interface external device 509, parallel interface control unit 510, parallel interface external device 511, display device control unit 512 and display device 513. Among them, CPU 501, RAM 502, ROM 503, hard disk control unit 504, human-computer interaction external device control unit 506, serial interface control unit 508, parallel interface control unit 510 and display device control unit 512 are connected to the system bus 500, and realize communication between each other through the system bus 500. In addition, the hard disk control unit 504 is connected to the hard disk 505; the human-computer interaction external device control unit 506 is connected to the human-computer interaction external device 507, which is typically a mouse, a trackball, a touch screen or a keyboard; the serial interface control unit 508 is connected to the serial interface external device 509; the parallel interface control unit 510 is connected to the parallel interface external device 511; and the display device control unit 512 is connected to the display device 513.
[0133] Figure 6 The structural block diagram merely shows the structure of a computer device that can practice various embodiments of the present invention, and is not intended to limit the practice environment of the present invention. In some cases, some devices in the computer device can be added or reduced as needed. For example, Figure 6 The device shown can remove the human-computer interaction external device 507 and the display device 513, and its specific implementation form is only a server that can be accessed by external devices. Figure 6 The computer devices shown can independently implement the operating environment of the present invention, or can be interconnected through a network to provide an operating environment suitable for each specific embodiment of the present invention. For example, each module and / or step of the present invention can be implemented in a distributed manner in each interconnected computer device.
[0134] The part involving software logic in the model control method provided by the present invention can be implemented using a programmable logic device, or can be implemented as a computer program product, which enables a computer to execute the method for the demonstration. The computer program product includes a computer-readable storage medium, which contains a computer program logic or code part, and is used to implement the various steps of the above-mentioned part involving software logic. The computer-readable storage medium can be a built-in medium installed in a computer or a removable medium that can be removed from the computer body (such as a hot-swappable storage device). The built-in medium includes but is not limited to a rewritable non-volatile memory, such as RAM, ROM and hard disk. The removable medium includes but is not limited to: optical storage media (such as CD-ROM and DVD), magneto-optical storage media (such as MO), magnetic storage media (such as magnetic tape or mobile hard disk), a medium with a built-in rewritable non-volatile memory (such as a memory card) and a medium with a built-in ROM (such as a ROM box).
[0135] Those skilled in the art will appreciate that any computer system with an appropriate programming device can perform the steps of the method of the present invention contained in the computer program product. Although most of the specific embodiments described in this specification focus on software programs, alternative embodiments that implement the method provided by the present invention in hardware are also within the scope of the present invention.
[0136] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and all changes within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other parts, units or steps, and the singular does not exclude the plural. Multiple parts, units or devices stated in the claims may also be implemented by one part, unit or device through software or hardware.
[0137] The above disclosure is only a part of the embodiments or specific implementations of the present invention, which cannot be used to limit the scope of rights of the present invention. Equivalent changes made according to the claims of the present invention are still within the scope covered by the present invention.
Claims
1. A model control method, characterized in that: The method comprises: Get the coordinates of the touch point on the screen; Converting the touch point coordinates on the screen into coordinates in the 3D scene; The equation of the first straight line in space is obtained based on the spatial coordinates of the virtual camera and the direction vector of the coordinates of the touch point in the 3D scene: in,( ) is the coordinate of the touch point in the 3D scene, ( ) is the space coordinate of the virtual camera; The equation of the first plane in space is obtained according to the initial screen coordinates of the auxiliary control body and the positive normal vector along the initial screen coordinates Z axis of the auxiliary control body: Among them, the initial screen coordinates of the auxiliary control body are ( ); According to the first linear equation in space and the first plane equation in space, the coordinates of the intersection of the straight line in the first linear equation in space and the plane in the first plane equation in space are obtained, and the coordinates of the intersection are the spatial coordinates of the auxiliary control body; Converting the spatial coordinates of the auxiliary control body into screen coordinates; Obtaining the screen coordinates of the model according to the screen coordinates of the auxiliary control body and a preset distance between the auxiliary control body and the model; Convert the screen coordinates of the model into coordinates in the 3D scene; The equation of the second straight line in space is obtained according to the coordinates of the model in the 3D scene and the spatial coordinates of the virtual camera: in,( ) is the space coordinate of the virtual camera, ( ) are the coordinates of the model in the 3D scene; The equation of the second plane in space is obtained according to the spatial coordinates of the auxiliary control body and the direction vector along the forward direction of the virtual camera as the normal vector: in,( ) is the coordinate of the intersection of the straight line in the first straight line equation in space and the plane in the first plane equation in space, ( ) is the forward direction vector of the virtual camera; According to the second linear equation in space and the second plane equation in space, the coordinates of the intersection of the straight line in the second linear equation in space and the plane in the second plane equation in space are obtained, and the coordinates of the intersection are the spatial coordinates of the model; The auxiliary control volume and the model are displayed according to the spatial coordinates of the auxiliary control volume and the spatial coordinates of the model.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining a target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen; An auxiliary control body corresponding to the target display range is displayed on the screen.
3. The method according to claim 2, characterized in that The process of obtaining the target display range of the auxiliary control body in space according to the space coordinates of the virtual camera, the space coordinates of the auxiliary control body and the preset display range of the auxiliary control body on the screen comprises: Converting the spatial coordinates of the auxiliary control body into screen coordinates; Obtaining the coordinates of a point on the circle in the X-axis direction of the auxiliary control body according to the screen coordinates of the auxiliary control body and a preset display range of the auxiliary control body on the screen; Convert the coordinates of the points on the circle in the X-axis direction of the auxiliary control body into coordinates in the 3D scene, and obtain the equation of the third straight line in space according to the coordinates of the points on the circle in the X-axis direction of the auxiliary control body in the 3D scene and the spatial coordinates of the virtual camera; Obtaining a third plane equation in space according to the spatial coordinates of the auxiliary control body and the direction vector along the forward direction of the virtual camera as a normal vector; Obtaining the coordinates of the intersection of the straight line in the third spatial straight line equation and the plane in the third spatial plane equation according to the third spatial straight line equation and the third spatial plane equation; The target display range of the auxiliary control body in space is obtained according to the intersection coordinates and the spatial coordinates of the auxiliary control body.
4. The method according to claim 3, characterized in that The auxiliary control body is a symmetrical figure, and the radius of the circle where the point on the circle is located is the maximum distance from the center point to the end point of the auxiliary control body in the preset display range.
5. The method according to claim 3, characterized in that: The auxiliary control body is an asymmetric figure, and the radius of the circle where the point on the circle is located is half of the maximum distance between the two end points of the auxiliary control body in the preset display range.
6. A model control device, characterized in that: The device comprises: A screen coordinate acquisition module is used to obtain the coordinates of the touch point on the screen; The auxiliary control body spatial coordinate calculation module is used to convert the touch point coordinates on the screen into coordinates in the 3D scene; obtain the spatial first straight line equation according to the spatial coordinates of the virtual camera and the direction vector of the coordinates of the touch point in the 3D scene; obtain the spatial first plane equation according to the initial screen coordinates of the auxiliary control body and the positive normal vector along the Z axis of the initial screen coordinates of the auxiliary control body; obtain the intersection coordinates of the straight line in the spatial first straight line equation and the plane in the spatial first plane equation according to the spatial first straight line equation and the spatial first plane equation, and the intersection coordinates are the spatial coordinates of the auxiliary control body; The equation of the first straight line is: ( ) is the coordinate of the touch point in the 3D scene, ( ) is the space coordinate of the virtual camera; The equation of the first plane is: The initial screen coordinates of the auxiliary control body are ( ); A model space coordinate calculation module, used for converting the space coordinates of the auxiliary control body into screen coordinates; obtaining the screen coordinates of the model according to the screen coordinates of the auxiliary control body and the preset distance between the auxiliary control body and the model; converting the screen coordinates of the model into coordinates in the 3D scene; obtaining the second spatial straight line equation according to the coordinates of the model in the 3D scene and the space coordinates of the virtual camera; obtaining the second spatial plane equation according to the space coordinates of the auxiliary control body and the direction vector along the forward direction of the virtual camera as the normal vector; obtaining the coordinates of the intersection of the straight line in the second spatial straight line equation and the plane in the second spatial plane equation according to the second spatial straight line equation and the second spatial plane equation, and the intersection coordinates are the space coordinates of the model; The equation of the second straight line is: ( ) is the space coordinate of the virtual camera, ( ) are the coordinates of the model in the 3D scene; The equation of the second plane is: ( ) is the coordinate of the intersection of the straight line in the first straight line equation in space and the plane in the first plane equation in space, ( ) is the forward direction vector of the virtual camera; A display module is used to display the auxiliary control body and the model according to the spatial coordinates of the auxiliary control body and the spatial coordinates of the model.
7. One or more computer-readable media storing computer-executable instructions, which, when used by one or more computer devices, cause the one or more computer devices to execute the model control method according to any one of claims 1 to 5.
8. A computer device comprising a memory and a processor, wherein: The memory stores a computer program, and the processor implements the model control method according to any one of claims 1 to 5 when executing the computer program.
Citation Information
Patent Citations
Information processing method and device, storage medium and electronic device
CN108355353A
Three-dimensional virtual model interaction method and device
CN110264568A