Search

CN-115738258-B - Virtual lens adjusting method and device, electronic equipment and storage medium

CN115738258BCN 115738258 BCN115738258 BCN 115738258BCN-115738258-B

Abstract

The application relates to the technical field of virtual scenes and discloses a method, a device, electronic equipment and a storage medium for adjusting a virtual lens, wherein the virtual lens is arranged in the virtual scene and defaults to follow a first virtual object in the virtual scene to acquire a picture, the method comprises the steps of determining the relative distance between the first virtual object and the second virtual object if a second virtual object which interacts with the first virtual object exists in the virtual scene, adjusting the position of the virtual lens in the virtual scene according to the relative distance, so that the adjusted first virtual object and second virtual object are located on two sides of a visual field symmetry plane corresponding to the virtual lens, and the distance difference between the distance from the first virtual object to the visual field symmetry plane and the distance from the second virtual object to the visual field symmetry plane does not exceed a preset threshold, and the scheme can ensure that the picture acquired by the virtual lens is balanced in the process of interaction between the first virtual object and the second virtual object, so that the user's look is improved.

Inventors

  • SUN MENGTING
  • XIE YUFEI

Assignees

  • 网易(杭州)网络有限公司

Dates

Publication Date
20260512
Application Date
20221114

Claims (12)

  1. 1. A method for adjusting a virtual lens is characterized in that the virtual lens is arranged in a virtual scene, and the virtual lens follows a first virtual object in the virtual scene by default to acquire a picture, and the method comprises the following steps: If a second virtual object which interacts with the first virtual object exists in the virtual scene, determining the relative distance between the first virtual object and the second virtual object; The position of the virtual lens in the virtual scene is adjusted according to the relative distance, so that the adjusted first virtual object and the adjusted second virtual object are respectively located on two sides of a visual field symmetry plane corresponding to the virtual lens, the distance difference between the distance from the first virtual object to the visual field symmetry plane and the distance from the second virtual object to the visual field symmetry plane does not exceed a preset threshold, and the visual field symmetry plane corresponding to the virtual lens is a symmetry plane which equally divides the visual field range corresponding to the virtual lens into two symmetrical parts; Wherein the adjusting the position of the virtual lens in the virtual scene according to the relative distance includes: if the relative distance is not smaller than a first reference distance, determining first translation information according to the position information of the first virtual object and the current position information of the virtual lens, wherein the first translation information is used for indicating the virtual lens to be translated from the current position to a first middle position so that the central axis of the first virtual object is positioned in a first view angle plane in a view range corresponding to the virtual lens, and the first view angle plane is positioned between a view symmetrical plane of the virtual lens and a view boundary plane of the virtual lens; Determining first rotation information according to the position information of the first virtual object and the first intermediate position, wherein the first rotation information is used for indicating that the virtual lens is rotated from the first intermediate position to a first target position by taking the central axis of the first virtual object as a rotation center; Controlling the virtual lens to move to the first target position according to the first translation information and the first rotation information, wherein the first target position is the position of the adjusted virtual lens, or If the relative distance is smaller than a first reference distance and the relative distance is larger than or equal to a second reference distance, determining second translation information according to the position information of the first virtual object and the current position information of the virtual lens, wherein the second translation information is used for indicating the virtual lens to be translated from the current position to a second intermediate position so that the central axis of the first virtual object is positioned in a first view angle plane in a view range corresponding to the virtual lens; Determining third translation information according to the second intermediate position and the position information of the first virtual object, wherein the third translation information is used for indicating the virtual lens to be translated from the second intermediate position to a direction close to the first virtual object to a third intermediate position; Determining second rotation information according to the position information of the first virtual object and the third intermediate position, wherein the second rotation information is used for indicating that the virtual lens is rotated from the third intermediate position to a second target position by taking the central axis of the first virtual object as a rotation center; Controlling the virtual lens to move to the second target position according to the second translation information, the third translation information and the second rotation information, wherein the second target position is the position of the adjusted virtual lens, or If the relative distance is smaller than the second reference distance, fourth translation information is determined according to a preset target distance, and the fourth translation information is used for indicating the virtual lens to be translated from the current position to a direction close to the first virtual object to a fourth intermediate position so that the distance between the first virtual object and the virtual lens is the target distance; Determining fifth translation information according to the fourth intermediate position and the position information of the first virtual object, wherein the fifth translation information is used for indicating the virtual lens to be translated from the fourth intermediate position to the fifth intermediate position so that the central axis of the first virtual object is positioned on a second view angle surface in a view range corresponding to the virtual lens; determining third rotation information according to the fifth intermediate position, the position information of the first virtual object and the position information of the second virtual object, wherein the third rotation information is used for indicating that the virtual lens is rotated from the fifth intermediate position to a third target position by taking the central axis of the first virtual object as a rotation center, so that the central axis of the second virtual object is positioned in a third view angle plane, and the third view angle plane and the second view angle plane are symmetrically distributed relative to the view symmetry plane of the virtual lens; And controlling the virtual lens to move to the third target position according to the fourth translation information, the fifth translation information and the third rotation information, wherein the third target position is the position of the adjusted virtual lens.
  2. 2. The method of claim 1, wherein after adjusting the position of the virtual lens, a distance from the first virtual object to a field of symmetry plane corresponding to the virtual lens is equal to a distance from the second virtual object to the field of symmetry plane corresponding to the virtual lens.
  3. 3. The method of claim 1, wherein the distance from the first virtual object to the view symmetry plane is the distance from a first edge of the first virtual object to the view symmetry plane, the distance from the second virtual object to the view symmetry plane is the distance from a second edge of the second virtual object to the view symmetry plane, the first edge is an edge of the first virtual object that is closer to the second virtual object, and the second edge is an edge of the second virtual object that is closer to the first virtual object.
  4. 4. The method of claim 1, wherein a distance from a central axis of the first virtual object to the field of view symmetry plane is taken as a distance from the first virtual object to the field of view symmetry plane, and a distance from a central axis of the second virtual object to the field of view symmetry plane is taken as a distance from the second virtual object to the field of view symmetry plane.
  5. 5. The method of claim 1, wherein a distance between a first intersection line and a second intersection line is equal to the relative distance, the first intersection line is an intersection line of the second view angle plane and a first reference plane, the second intersection line is an intersection line of the first reference plane and a third view angle plane within a visual field range of the virtual lens, the third view angle plane and the second view angle plane are symmetrically distributed with respect to a visual field symmetry plane of the virtual lens, and the first reference plane is a plane perpendicular to a central axis of the virtual lens and having a distance from the virtual lens equal to the relative distance.
  6. 6. The method according to any one of claims 1 to 2, wherein the first reference distance is equal to a product of a first coefficient e (0, 1) and a first distance equal to a maximum distance between a first view angle plane and a fourth view angle plane within a field of view of the virtual lens, the fourth view angle plane and the first view angle plane being symmetrically distributed with respect to the field of view symmetry plane.
  7. 7. The method of claim 6, wherein the first coefficient is equal to 1/3.
  8. 8. The method of claim 1, wherein the second reference distance is equal to a distance between a third intersection line and a fourth intersection line, the third intersection line is an intersection line between a second reference plane and the first viewing angle plane, the fourth intersection line is an intersection line between the second reference plane and a fourth viewing angle plane in a field of view corresponding to the virtual lens, the fourth viewing angle plane and the first viewing angle plane are symmetrically distributed with respect to the field of view symmetry plane, and the second reference plane is a plane perpendicular to a central axis of the virtual lens and having a target distance from the virtual lens.
  9. 9. The method of claim 1, wherein the first view angle plane is a trisection view angle plane obtained by trisecting a view angle corresponding to the virtual lens.
  10. 10. The device for adjusting the virtual lens is characterized in that the virtual lens is arranged in a virtual scene, and the virtual lens follows a first virtual object in the virtual scene by default to acquire a picture, and the device comprises: The determining module is used for determining the relative distance between the first virtual object and the second virtual object if the second virtual object which interacts with the first virtual object exists in the virtual scene; The adjusting module is used for adjusting the position of the virtual lens in the virtual scene according to the relative distance, so that the adjusted first virtual object and the adjusted second virtual object are respectively located on two sides of a visual field symmetry plane corresponding to the virtual lens, the distance difference between the distance from the first virtual object to the visual field symmetry plane and the distance from the second virtual object to the visual field symmetry plane does not exceed a preset threshold, and the visual field symmetry plane corresponding to the virtual lens is a symmetry plane which equally divides the visual field range corresponding to the virtual lens into two symmetrical parts; wherein the adjusting the position of the virtual lens in the virtual scene according to the relative distance comprises If the relative distance is not smaller than a first reference distance, determining first translation information according to the position information of the first virtual object and the current position information of the virtual lens, wherein the first translation information is used for indicating the virtual lens to be translated from the current position to a first middle position so that the central axis of the first virtual object is positioned in a first view angle plane in a view range corresponding to the virtual lens, and the first view angle plane is positioned between a view symmetrical plane of the virtual lens and a view boundary plane of the virtual lens; Determining first rotation information according to the position information of the first virtual object and the first intermediate position, wherein the first rotation information is used for indicating that the virtual lens is rotated from the first intermediate position to a first target position by taking the central axis of the first virtual object as a rotation center; Controlling the virtual lens to move to the first target position according to the first translation information and the first rotation information, wherein the first target position is the position of the adjusted virtual lens, or If the relative distance is smaller than a first reference distance and the relative distance is larger than or equal to a second reference distance, determining second translation information according to the position information of the first virtual object and the current position information of the virtual lens, wherein the second translation information is used for indicating the virtual lens to be translated from the current position to a second intermediate position so that the central axis of the first virtual object is positioned in a first view angle plane in a view range corresponding to the virtual lens; Determining third translation information according to the second intermediate position and the position information of the first virtual object, wherein the third translation information is used for indicating the virtual lens to be translated from the second intermediate position to a direction close to the first virtual object to a third intermediate position; Determining second rotation information according to the position information of the first virtual object and the third intermediate position, wherein the second rotation information is used for indicating that the virtual lens is rotated from the third intermediate position to a second target position by taking the central axis of the first virtual object as a rotation center; Controlling the virtual lens to move to the second target position according to the second translation information, the third translation information and the second rotation information, wherein the second target position is the position of the adjusted virtual lens, or If the relative distance is smaller than the second reference distance, fourth translation information is determined according to a preset target distance, and the fourth translation information is used for indicating the virtual lens to be translated from the current position to a direction close to the first virtual object to a fourth intermediate position so that the distance between the first virtual object and the virtual lens is the target distance; Determining fifth translation information according to the fourth intermediate position and the position information of the first virtual object, wherein the fifth translation information is used for indicating the virtual lens to be translated from the fourth intermediate position to the fifth intermediate position so that the central axis of the first virtual object is positioned on a second view angle surface in a view range corresponding to the virtual lens; determining third rotation information according to the fifth intermediate position, the position information of the first virtual object and the position information of the second virtual object, wherein the third rotation information is used for indicating that the virtual lens is rotated from the fifth intermediate position to a third target position by taking the central axis of the first virtual object as a rotation center, so that the central axis of the second virtual object is positioned in a third view angle plane, and the third view angle plane and the second view angle plane are symmetrically distributed relative to the view symmetry plane of the virtual lens; And controlling the virtual lens to move to the third target position according to the fourth translation information, the fifth translation information and the third rotation information, wherein the third target position is the position of the adjusted virtual lens.
  11. 11. An electronic device, comprising: A processor; A memory having stored thereon computer readable instructions which, when executed by the processor, implement the method of any of claims 1 to 9.
  12. 12. A computer readable storage medium having stored thereon computer readable instructions which, when executed by a processor, implement the method of any of claims 1 to 9.

Description

Virtual lens adjusting method and device, electronic equipment and storage medium Technical Field The present application relates to the field of virtual scene technologies, and in particular, to a method and apparatus for adjusting a virtual lens, an electronic device, and a storage medium. Background In a three-dimensional game, a virtual lens is generally set to capture a picture following a virtual lens manipulated by a player, and the virtual lens is also set to capture a picture following a virtual object manipulated by the player during interaction of the virtual object manipulated by the player with other virtual objects in the game. In this case, in the captured picture, although the virtual object manipulated by the player is located near the central axis of the picture, other virtual objects that interact with it are either left or right, and thus, the captured picture is overall unbalanced, resulting in poor user perception. Disclosure of Invention In view of the above problems, embodiments of the present application provide a method, an apparatus, an electronic device, and a storage medium for adjusting a virtual lens, so as to solve the problem that images acquired by the virtual lens in a virtual scene are unbalanced, and the user's look and feel is poor. According to one aspect of the embodiment of the application, an adjusting method of a virtual lens is provided, the virtual lens is arranged in a virtual scene, the virtual lens defaults to follow a first virtual object in the virtual scene to acquire images, the method comprises the steps of determining the relative distance between the first virtual object and the second virtual object if a second virtual object which interacts with the first virtual object exists in the virtual scene, and adjusting the position of the virtual lens in the virtual scene according to the relative distance so that the adjusted first virtual object and second virtual object are located on two sides of a visual field symmetry plane corresponding to the virtual lens, and the distance difference between the distance from the first virtual object to the visual field symmetry plane and the distance from the second virtual object to the visual field symmetry plane does not exceed a preset threshold value. According to one aspect of the embodiment of the application, an adjusting device of a virtual lens is provided, wherein the virtual lens is arranged in a virtual scene, the virtual lens defaults to follow a first virtual object in the virtual scene to acquire images, the device comprises a determining module, an adjusting module and a control module, wherein the determining module is used for determining the relative distance between the first virtual object and the second virtual object if a second virtual object which interacts with the first virtual object exists in the virtual scene, and the adjusting module is used for adjusting the position of the virtual lens in the virtual scene according to the relative distance so that the adjusted first virtual object and the adjusted second virtual object are separated on two sides of a visual field symmetry plane corresponding to the virtual lens, and the distance difference between the distance from the first virtual object to the visual field symmetry plane and the distance from the second virtual object to the visual field symmetry plane does not exceed a preset threshold. According to one aspect of the embodiment of the application, an electronic device is provided, which comprises a processor and a memory, wherein the memory is stored with computer readable instructions, and the computer readable instructions realize the adjustment method of the virtual lens when being executed by the processor. According to an aspect of an embodiment of the present application, there is provided a computer-readable storage medium having stored thereon computer-readable instructions which, when executed by a processor, implement the method of adjusting a virtual lens as described above. According to an aspect of an embodiment of the present application, there is provided a computer program product comprising computer instructions which, when executed by a processor, implement a method of adjusting a virtual lens as above. In the scheme of the application, when a second virtual object which interacts with the first virtual object exists in the virtual scene, the position of the virtual lens which originally follows the first virtual object is adjusted according to the relative distance between the first virtual object and the second virtual object, so that the first virtual object and the second virtual object after the position adjustment are separated on two sides of the view symmetry plane corresponding to the virtual lens after the position adjustment, and the distance difference between the distance from the first virtual object to the view symmetry plane corresponding to the virtual lens after the position adjustment and th