Method for adjusting camera angle of view in game and electronic device
Automatically adjusting the virtual camera angle of view through the terminal device solves the cumbersome problem of manual configuration and switching of camera angles in the existing technology, and improves the player experience and information presentation of battle games.
Patent Information
- Application Number
- CN202010815559.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-13
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-08-13
AI Technical Summary
The camera perspective scheme in existing battle games requires manual configuration and switching, resulting in a heavy workload and cumbersome operations, which affects the player's gaming experience.
Provide a graphical user interface through the terminal device, respond to lens adjustment events, obtain virtual character position information, automatically adjust the perspective of the virtual lens, and make smooth adjustments based on the target perspective and preset conditions to ensure that the lens perspective is always appropriate.
It simplifies player operations, improves the game experience, alleviates problems such as the virtual camera being blocked and the target virtual character leaving the camera screen, and provides richer battle information.
Smart Images

Figure CN111888762B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a method for adjusting the camera angle in a game and an electronic device. Background Art
[0002] The camera is the first window to present the game screen. Different camera angles will bring different visual experiences to players. Different types of games require different camera angles, and the same game may also need to use different camera angles to perform in different scenarios.
[0003] The existing camera perspective solutions in fighting games usually require pre-configuration of multiple fixed perspectives in different game areas, and players can switch between these fixed perspectives during the game. However, in fighting games, since players need to change perspectives frequently, the workload of pre-configuring the camera position is large, and the manual switching between perspectives is also cumbersome, resulting in a poor gaming experience for players.
[0004] In general, the existing camera perspective solutions in fighting games still have the problems of large workload of manually configuring the camera position and cumbersome operation of manually switching the camera perspective. Summary of the invention
[0005] In view of this, an object of the present invention is to provide a method and electronic device for adjusting the camera angle in a game, which can automatically switch the camera angle in a fighting game to present a better viewing angle, simplify the player's operation, and enhance the player's gaming experience.
[0006] In a first aspect, an embodiment of the present invention provides a method for adjusting the camera angle of view in a game, wherein a graphical user interface is provided through a terminal device, and a game scene is displayed in the graphical user interface. The game scene includes a first virtual character and a target virtual character. The method comprises: responding to a lens adjustment event, obtaining a first position of the first virtual character in the game scene and a second position of the target virtual character in the game scene; determining a target angle of view orientation of a preset virtual lens based on the first position and the second position, and adjusting the camera angle of view of the virtual lens from a current angle of view orientation to the target angle of view orientation; and determining the game scene in the graphical user interface based on the target angle of view orientation.
[0007] In a preferred embodiment of the present invention, the above-mentioned lens adjustment event includes at least one of the following: determining that the first virtual character hits the target virtual character, and the time length from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold; determining that the target virtual character is attacked into the air; determining that the first virtual character is attacked into the air, and the current viewing angle direction of the virtual lens is offset relative to the preset viewing angle direction.
[0008] In a preferred embodiment of the present invention, when the lens adjustment event is to determine that the first virtual character hits the target virtual character, and the time length from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold, the step of determining the target viewing angle orientation of the preset virtual lens according to the first position and the second position includes: calculating the first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating the second display position of the target virtual character projected onto the graphical user interface according to the second position; calculating the total lens viewing angle offset of the preset virtual lens according to the first display position and the second display position; calculating the lens viewing angle offset distance of the virtual lens when shooting the current image frame according to the total lens viewing angle offset and the preset smoothing time of the virtual lens; and determining the target viewing angle orientation of the virtual lens when shooting the current image frame according to the preset viewing angle orientation and the lens viewing angle offset distance.
[0009] In a preferred embodiment of the present invention, after the above-mentioned step of adjusting the lens angle of the virtual lens from the current viewing angle position to the target viewing angle position, the method further includes: if the first virtual character does not hit the target virtual character again within a preset second time threshold after the lens angle of the virtual lens is adjusted from the current viewing angle position to the target viewing angle position, the lens angle of the virtual lens is restored to the viewing angle position before the offset.
[0010] In a preferred embodiment of the present invention, when the lens adjustment event is to determine that the target virtual character is attacked into the air, or to determine that the first virtual character is attacked into the air, and the current viewing angle of the virtual lens is offset relative to the preset viewing angle, the step of determining the target viewing angle of the preset virtual lens according to the first position and the second position includes: calculating a first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating a second display position of the target virtual character projected onto the graphical user interface according to the second position; and calculating the correlation between the first display position and the second display position and the graphical user interface. a first minimum value among the ratios of the distance from the horizontal boundary of the image processing unit to the height of the graphical user interface; comparing the first minimum value with a preset first ratio threshold value and a second ratio threshold value to obtain a comparison result; wherein the first ratio threshold value is less than the second ratio threshold value; determining a stretching form for the viewing angle orientation of a preset virtual lens according to the comparison result; the stretching form includes zooming out, zooming in and not stretching; calculating a stretching distance for the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold value and the second ratio threshold value; calculating a target viewing angle orientation of the virtual lens according to the stretching form, the stretching distance and the current viewing angle orientation of the virtual lens.
[0011] In a preferred embodiment of the present invention, the step of determining the stretching form of the viewing angle orientation of the preset virtual lens based on the comparison result includes: if the first minimum value is less than the first ratio threshold, or if the first display position of the first virtual character or the second display position of the target virtual character is not within the range of the graphical user interface, determining that the stretching form of the viewing angle orientation of the preset virtual lens is zooming out; if the first minimum value is greater than the second ratio threshold, determining that the stretching form of the viewing angle orientation of the virtual lens is zooming in; if the first minimum value is greater than the first ratio threshold and less than the second ratio threshold, determining that the stretching form of the viewing angle orientation of the virtual lens is not stretching.
[0012] In a preferred embodiment of the present invention, the step of calculating the stretching distance of the lens angle of view of the virtual lens based on the first minimum value, the first ratio threshold and the second ratio threshold includes: if the stretching form is zooming out, calculating the zooming distance of the lens angle of view of the virtual lens based on the first minimum value, the first ratio threshold and the preset lens stretching speed and lens smoothing time; if the stretching form is zooming in, calculating the zooming distance of the lens angle of view of the virtual lens based on the first minimum value, the second ratio threshold, the lens stretching speed and the lens smoothing time.
[0013] In a preferred embodiment of the present invention, after the above-mentioned step of adjusting the lens angle of the virtual lens to the target viewing angle orientation, the method further includes: if it is detected that the first virtual character or the target virtual character attacked into the air has landed, and the landing time exceeds a preset third time threshold, restoring the lens angle of the virtual lens to the viewing angle orientation before stretching.
[0014] In a preferred embodiment of the present invention, the above method also includes: if the current viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when the second trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before the offset is met, determining a first satisfaction degree of the first trigger condition for restoring the virtual lens to the viewing angle before the stretching; if the first satisfaction degree reaches the preset first degree requirement, restoring the lens viewing angle of the virtual lens to the preset viewing angle.
[0015] In a preferred embodiment of the present invention, the step of determining the first degree of satisfaction of the first trigger condition for restoring the virtual lens to the viewing angle before stretching includes: if it is detected that the first virtual character or the target virtual character that was attacked into the air has landed, calculating a first ratio of the landing duration to the third time threshold; determining the first ratio as the first degree of satisfaction of the first trigger condition for restoring the virtual lens to the viewing angle before stretching.
[0016] In a preferred embodiment of the present invention, the above method also includes: if the viewing angle orientation of the virtual lens is both offset and stretched compared to the preset viewing angle orientation, when the first trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle orientation before stretching is met, determining a second satisfaction degree of a second trigger condition for restoring the virtual lens to the viewing angle orientation before the offset; if the second satisfaction degree reaches the preset second degree requirement, restoring the lens viewing angle of the virtual lens to the preset viewing angle orientation.
[0017] In a preferred embodiment of the present invention, the step of determining the second degree of satisfaction of the second trigger condition for restoring the virtual lens to the viewing angle before the offset includes: calculating a second ratio of the duration during which the first virtual character does not hit the target virtual character again to the second time threshold; and determining the second ratio as the second degree of satisfaction of the second trigger condition for restoring the virtual lens to the viewing angle before the offset.
[0018] In a second aspect, an embodiment of the present invention further provides a method for adjusting the camera angle of view in a game, wherein a graphical user interface is provided through a terminal device, wherein a game scene is displayed in the graphical user interface, and the game scene includes a first virtual character. The method comprises: obtaining a first position of the first virtual character in the game scene; determining, based on the first position, whether there is an obstacle between the first virtual character and a preset virtual lens; if there is an obstacle, determining a target camera angle of view of the virtual lens based on the first position, and adjusting the camera angle of view of the virtual lens from a current camera angle of view to the target camera angle of view; and determining the game scene in the graphical user interface based on the target camera angle of view.
[0019] In a preferred embodiment of the present invention, the step of determining whether there is an obstacle between the first virtual character and the preset virtual lens based on the first position includes: judging whether there is an obstacle between the virtual lens and the first virtual character through a ray detection algorithm based on the first position and the third position of the virtual lens in the game scene.
[0020] In a preferred embodiment of the present invention, the step of determining whether there is an obstacle between the virtual lens and the first virtual character by a ray detection algorithm based on the first position and the third position of the virtual lens in the game scene includes: taking the third position of the virtual lens in the game scene as the starting point of the ray, emitting a ray to the first position, and if the ray detects a collision between the third position and the first position, determining that there is an obstacle between the virtual lens and the first virtual character.
[0021] In a preferred embodiment of the present invention, the step of determining the target viewing angle orientation of the virtual lens based on the first position includes: determining the position where the ray detects the collision as the position where the obstacle is located; and determining the position before the position where the obstacle is located as the target viewing angle orientation of the virtual lens.
[0022] In a third aspect, an embodiment of the present invention further provides a device for adjusting the lens perspective in a game, wherein a graphical user interface is provided through a terminal device, wherein a game scene is displayed in the graphical user interface, wherein the game scene includes a first virtual character and a target virtual character, and the device includes: a first position acquisition module, for responding to a lens adjustment event, and acquiring a first position of the first virtual character in the game scene and a second position of the target virtual character in the game scene; a target perspective orientation determination module, for determining a target perspective orientation of a preset virtual lens based on the first position and the second position, and adjusting the lens perspective of the virtual lens from a current perspective orientation to the target perspective orientation; and a first game scene determination module, for determining the game scene in the graphical user interface based on the target perspective orientation.
[0023] In a fourth aspect, an embodiment of the present invention further provides a device for adjusting the camera angle of view in a game, wherein a graphical user interface is provided through a terminal device, wherein a game scene is displayed in the graphical user interface, wherein the game scene includes a first virtual character, and the device includes: a second position acquisition module, for acquiring a first position of the first virtual character in the game scene; an obstacle determination module, for determining, based on the first position, whether there is an obstacle between the first virtual character and a preset virtual camera; a view orientation adjustment module, for determining, if there is an obstacle, a target view orientation of the virtual camera based on the first position, and adjusting the camera angle of the virtual camera from a current view orientation to the target view orientation; and a second game scene module, for determining the game scene in the graphical user interface based on the target view orientation.
[0024] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method for adjusting the camera angle in the above-mentioned game.
[0025] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for adjusting the camera angle in the above-mentioned game.
[0026] The embodiments of the present invention bring the following beneficial effects:
[0027] The embodiment of the present invention provides a method and electronic device for adjusting the lens angle in a game. In response to a lens adjustment event, the first position of the first virtual character in the game scene and the second position of the target virtual character in the game scene are obtained; according to the first position and the second position, the target angle of view of the preset virtual lens is determined, and the lens angle of the virtual lens is adjusted from the current angle of view to the target angle of view; and the game scene in the graphical user interface is determined according to the target angle of view. In this method, the lens angle of the virtual lens is automatically adjusted according to the position information of the first virtual character and the target virtual character, and more abundant battle information is presented to the player, which can alleviate problems such as the virtual lens being blocked and the target virtual character leaving the lens screen. This method simplifies the player's switching operation for the lens angle and improves the game experience.
[0028] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present disclosure.
[0029] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 A schematic diagram of a flow chart of a method for adjusting the camera angle of view in a game provided by an embodiment of the present invention;
[0032] Figure 2 A schematic diagram of a process for determining a target viewing angle of a virtual lens provided by an embodiment of the present invention;
[0033] Figure 3 A schematic diagram of projecting coordinate positions in a game scene onto a graphical user interface provided by an embodiment of the present invention;
[0034] Figure 4 A schematic diagram of another process for determining a target viewing angle of a virtual lens provided by an embodiment of the present invention;
[0035] Figure 5 A schematic diagram of dividing a graphical user interface into regions provided by an embodiment of the present invention;
[0036] Figure 6 A schematic flow chart of another method for adjusting the camera angle in a game provided by an embodiment of the present invention;
[0037] Figure 7 A schematic diagram of adjusting the lens viewing angle in a scenario where a virtual lens is blocked provided by an embodiment of the present invention;
[0038] Figure 8 A schematic diagram of the structure of a device for adjusting the camera angle of view in a game provided by an embodiment of the present invention;
[0039] Fig. 9 A schematic diagram of the structure of another device for adjusting the camera angle of view in a game provided by an embodiment of the present invention;
[0040] Fig.10 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0041] Icons: 31-virtual lens; 32-graphical user interface; 51-lens zoom-out area; 52-lens zoom-in area; 71-first virtual character; 72-obstacle; 81-first position acquisition module; 82-target view angle determination module; 83-first game scene determination module; 91-second position acquisition module; 92-obstacle determination module; 93-view angle adjustment module; 94-second game scene module; 101-processor; 102-memory; 103-bus; 104-communication interface. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] In existing games, two camera angle settings are usually used. One is a fixed angle, that is, the camera is always fixed at a relative position behind the first virtual character controlled by the player, such as the application in Meteor Butterfly Sword. This solution is simple to implement, but at certain angles, the target virtual character in the battle will be blocked by the first virtual character, resulting in a bad gaming experience. Another way is to pre-configure multiple fixed angles in different game areas. During the game, players can switch between these fixed angles, such as the application in Legend of the Holy Sword, where the map is divided into different areas. When the character enters a specific area, the angle will switch to the pre-set angle of the area.
[0044] Considering the existing camera angle solutions in battle games, there are still problems such as the large workload of manually configuring the camera position and the cumbersome operation of manually switching the camera angle. The embodiment of the present invention provides a method for adjusting the camera angle in a game and an electronic device. The technology can be applied to various game scenes that require adjustment and control of the camera angle. To facilitate understanding of this embodiment, a method for adjusting the camera angle in a game disclosed in an embodiment of the present invention is first introduced in detail.
[0045] In one embodiment of the present disclosure, the method for adjusting the camera angle in the game can be run on a terminal device or a server. The terminal device can be a local terminal device. When the method for adjusting the camera angle in the game is run on a server, the method for adjusting the camera angle in the game can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0046] In an optional implementation, various cloud applications, such as cloud games, can be run under the cloud interaction system. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the lens angle adjustment method in the game are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for information processing is a cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.
[0047] In an optional embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.
[0048] See also Figure 1, which is a flow chart of a method for adjusting the lens angle of view in a game provided by an embodiment of the present invention, wherein a graphical user interface is provided by a terminal device, and a game scene is displayed in the graphical user interface, and the game scene includes a first virtual character and a target virtual character. Here, the terminal device can be the local terminal device mentioned above, or it can be a client device in the cloud interaction system mentioned above. Moreover, the game scene is obtained by a virtual lens in the game scene taking a picture of the game scene based on a preset angle of view.
[0049] Depend on Figure 1 It can be seen that the method comprises the following steps:
[0050] Step S102: In response to the lens adjustment event, a first position of the first virtual character in the game scene and a second position of the target virtual character in the game scene are obtained.
[0051] Here, when it is determined to adjust the virtual lens, the terminal device responds to the lens adjustment event and triggers the following steps of adjusting the lens. The first virtual character may be a virtual person, a virtual animal, or a virtual equipment (such as a tank), etc., which is not limited here. Correspondingly, the target virtual character may also be the corresponding virtual type mentioned above.
[0052] In one possible implementation, for example, in a battle game, the target virtual character may be the target of the battle with the first virtual character controlled by the player. Taking the game of Counter-Strike as an example, assuming that the first virtual character controlled by the player is an elite soldier, the designated target virtual character may be a terrorist fighting against the elite soldier.
[0053] The game scene displayed in the graphical user interface is obtained by photographing the game scene based on a preset viewing angle through a virtual lens set in the game scene. Here, the preset viewing angle can be set at a fixed position behind the first virtual character controlled by the player (such as 1 meter behind the first virtual character and flush with the head of the first virtual character). When the first virtual character moves, the preset lens viewing angle also moves accordingly to keep the lens viewing angle at this fixed position behind the first virtual character at all times. In this way, the game scene photographed through the preset lens viewing angle can better reflect the scene information directly in front of the first virtual character.
[0054] In addition, the game scene is a three-dimensional space, and at any time during the game, the first virtual character and the target virtual character have corresponding unique coordinate positions in the game scene. Here, the first position corresponding to the first virtual character in the game scene and the second position corresponding to the target virtual character in the game scene are obtained.
[0055] Step S104: determining a target viewing angle of a preset virtual lens according to the first position and the second position, and adjusting the lens viewing angle of the virtual lens from the current viewing angle to the target viewing angle.
[0056] According to the introduction of the above technical background, in existing games, two camera perspective setting methods are usually used, one is a fixed perspective, and the other is to pre-configure multiple fixed perspectives in different game areas, and players can switch between these fixed perspectives.
[0057] Compared with the above two lens perspective setting methods, in this embodiment, the lens perspective adjustment event is triggered in combination with the position of the first virtual character and the position of the target virtual character. Once the event is triggered, the lens perspective is automatically adjusted without manually setting multiple fixed perspectives in advance, and there is no need for the player to manually switch the lens perspective, so the operation is more convenient and quick.
[0058] Here, the target viewing angle is related to the first position and the second position, that is, after the lens viewing angle adjustment event is triggered, in order to obtain information about the local game scene where the first virtual character and the target virtual character are located, the target viewing angle is determined based on the first position of the first virtual character and the second position of the target virtual character. After the target viewing angle of the virtual lens is determined, the lens viewing angle of the virtual lens is adjusted to the target viewing angle.
[0059] Step S106: determining a game scene in the graphical user interface according to the target viewing angle.
[0060] After the lens angle of the virtual lens is adjusted to the target angle of view, the virtual lens takes a picture of the game scene based on the target angle of view, thereby obtaining the game scene presented in the above-mentioned graphical user interface after the lens angle of view is adjusted.
[0061] An embodiment of the present invention provides a method for adjusting the lens angle in a game. In response to a lens adjustment event, the first position of the first virtual character in the game scene and the second position of the target virtual character in the game scene are obtained; according to the first position and the second position, the target angle of view of the preset virtual lens is determined, and the lens angle of the virtual lens is adjusted from the current angle of view to the target angle of view; and the game scene in the graphical user interface is determined according to the target angle of view. In this method, the lens angle of the virtual lens is automatically adjusted according to the position information of the first virtual character and the target virtual character, and more abundant battle information is presented to the player, which can alleviate problems such as the virtual lens being blocked and the target virtual character leaving the lens screen. This method simplifies the player's switching operation for the lens angle and improves the game experience.
[0062] In a battle game scenario, the following problem may occur: when the target virtual character that the player controls is in a certain corner of the screen, the player cannot get enough information about the target virtual character and thus cannot make a correct decision quickly. Figure 1 Based on the method for adjusting the camera angle of view in the game shown, this embodiment also provides another method for adjusting the camera angle of view in the game.
[0063] In this embodiment, when the terminal device determines that the first virtual character hits the target virtual character, and the time from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold, the lens adjustment program is triggered to execute, and the target viewing angle orientation of the virtual lens is determined through the first position of the first virtual character in the game scene and the second position of the target virtual character in the game scene, thereby adjusting the lens viewing angle of the virtual lens from the current viewing angle orientation to the target viewing angle orientation.
[0064] That is, the lens adjustment event is: it is determined that the first virtual character hits the target virtual character, and the time from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold. For example, assuming that the first time threshold is 2 seconds, if the first virtual character hits the target virtual character for the first time in the current attack for 2 seconds, it is determined that the lens angle adjustment event is triggered, so that the lens angle is automatically adjusted.
[0065] See also Figure 2 , which is a schematic diagram of a process for determining the target viewing angle of a virtual lens, Figure 2 The specific implementation process of determining the target viewing angle of the virtual lens in this embodiment is shown. Figure 2 It can be seen that the process includes the following steps:
[0066] Step S202: calculating a first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating a second display position of the target virtual character projected onto the graphical user interface according to the second position.
[0067] like Figure 3 As shown in FIG. 1 , it is a schematic diagram of projecting the coordinate position in the game scene to the graphical user interface. Figure 3In the illustrated embodiment, when the virtual lens 31 takes a picture of the game scene, the virtual objects A and B in the game scene are projected into a rectangle of a certain size, corresponding to C and D in the figure, respectively, and the rectangular image is the game scene image presented on the graphical user interface 32. Here, the virtual objects A and B may correspond to the first position of the first virtual character and the second position of the target virtual character, and C and D in the figure correspond to the first display position and the second display position after projection, respectively.
[0068] Step S204: calculating the total amount of lens viewing angle offset of the preset virtual lens according to the first display position and the second display position.
[0069] In this embodiment, the formula for calculating the total amount of lens viewing angle offset of the virtual lens according to the first display position and the second display position includes:
[0070] CameraOffset=(Px1+Px2)*0.5-ScreenWidth*0.5
[0071] In the formula, CameraOffset represents the total amount of lens angle offset of the virtual lens; Px1 represents the horizontal axis coordinate value of the first display position in the preset display interface coordinate system; Px2 represents the horizontal axis coordinate value of the second display position in the display interface coordinate system; wherein, the display interface coordinate system takes the upper left corner of the graphical user interface as the coordinate origin, the upper boundary of the graphical user interface as the horizontal axis, and the left boundary of the graphical user interface as the vertical axis; ScreenWidth represents the width of the graphical user interface.
[0072] Through the above method, the two opposing parties can be made to appear symmetrical in the camera, so that the target virtual character of the battle can be more presented in the game screen.
[0073] Step S206: Calculate the lens angle offset distance of the virtual lens when shooting the current image frame according to the total lens angle offset and the preset smoothing time of the virtual lens.
[0074] In this embodiment, the formula for calculating the lens angle offset distance of the virtual lens when shooting the current image frame based on the total lens angle offset and the preset smoothing time of the virtual lens includes:
[0075]
[0076] In the formula, DeltaOffset represents the lens angle offset distance of the virtual lens; CameraOffset represents the total lens angle offset of the virtual lens; SmoothTime represents the smoothing time of the virtual lens; DeltaTime represents the time taken to generate the current image frame; RightDir represents the unit vector of the right direction of the virtual lens in the game scene.
[0077] Step S208: determining the target viewing angle orientation of the virtual lens when shooting the current image frame according to the preset viewing angle orientation and the viewing angle offset distance of the lens.
[0078] In actual operation, in order to avoid the illusion of lens jump caused by instantaneous translation adjustment of the lens angle, the virtual lens is usually smoothed to the target angle of view at a certain speed. Therefore, in the process of adjusting the angle of view of the virtual lens, the virtual lens corresponds to a target angle of view when shooting each frame of the image. For example, assuming that the total amount of lens angle of view offset of the virtual lens is calculated to be 100 pixels, and the lens angle of view offset distance of the virtual lens when shooting the current image frame is: 10 pixels offset to the right of the virtual lens, then the target angle of view of the virtual lens corresponding to the current first frame of the image is: the position of the preset angle of view is offset to the right of the virtual lens by 10 pixels. By analogy, the target angle of view corresponding to other image frames in the process of adjusting the lens angle of view can be obtained.
[0079] In this way, the above method can realize the automatic triggering of the symmetrical lens in the game, so as to present the target virtual character and the first virtual character in the user graphical interface in a symmetrical form. In actual operation, after the virtual lens is triggered to automatically adjust to the symmetrical lens, a corresponding exit condition can also be set.
[0080] In at least one possible implementation, after the above step of adjusting the lens angle of the virtual lens to the target angle of view, if the first virtual character does not hit the target virtual character again within a preset second time threshold after the lens angle of the virtual lens is adjusted to the target angle of view, the lens angle of the virtual lens is restored to the angle of view before the offset. For example, assuming that the second time threshold is 8 seconds, if the first virtual character does not hit the target virtual character again within 8 seconds after the center lens algorithm (or lens symmetry algorithm) is triggered, it is considered that the battle is exited. At this time, the symmetric lens is automatically released, and the lens angle of the virtual lens is restored to the angle of view before the offset.
[0081] The method for adjusting the camera angle of view in the game provided by this embodiment automatically displays the first virtual character and the target virtual character symmetrically in the graphical user interface when the first virtual character attacks the target virtual character, thereby avoiding the problem that when the target virtual character is in a corner, the image taken by the virtual camera according to the preset viewing angle is difficult to present sufficient information around the target virtual character. Richer battle scene information can be presented to the players, thereby improving the gaming experience.
[0082] In actual game operation, the following problem may also be encountered: during the game battle, when either side suddenly moves into the air, one side is usually at the edge of the camera or even out of the camera, which makes it impossible for the player to obtain enough battle information to make an accurate judgment. Figure 1 Based on the method of adjusting the camera angle of view in the game shown, the method of adaptively adjusting the camera angle of view of the virtual camera is further improved.
[0083] In this embodiment, when the terminal device determines that the target virtual character is attacked into the air, or determines that the first virtual character is attacked into the air and the current viewing angle of the virtual lens is offset relative to the preset viewing angle, the lens adjustment program is triggered to execute, and the target viewing angle of the virtual lens is determined through the first position of the first virtual character in the game scene and the second position of the target virtual character in the game scene, thereby adjusting the lens viewing angle of the virtual lens from the current viewing angle to the target viewing angle.
[0084] That is, in the method for adjusting the lens angle of view in the game of the present embodiment, the lens adjustment event is: determining that the target virtual character is attacked in the air, or determining that the first virtual character is attacked in the air, and the current angle of view of the virtual lens is offset relative to the preset angle of view. Here, it is assumed that the coordinates of the second position corresponding to the target virtual character in the game scene are (x0, y0, z0), wherein the vertical axis Z value corresponding to the plane where the ground in the game scene is located is 0, so that when the first virtual character and the target virtual character are in a battle scene, if z0 is not equal to 0, it indicates that the target virtual character is attacked in the air. Similarly, according to the coordinates of the first virtual character, it can also be determined whether the first virtual character is attacked in the air.
[0085] Here, when the center shot is triggered, if the first virtual character is attacked into the air, the shot angle adjustment event is determined to be triggered. Regardless of whether the symmetrical shot is triggered, as long as the target virtual character is attacked into the air, the shot angle adjustment event is determined to be triggered.
[0086] See also Figure 4 , which is another flow chart of determining the target viewing angle of a virtual lens. Figure 4 The specific implementation process of determining the target viewing angle of the virtual lens in this embodiment is shown. Figure 4 It can be seen that the process includes the following steps:
[0087] Step S402: calculating a first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating a second display position of the target virtual character projected onto the graphical user interface according to the second position.
[0088] Step S404: Calculate a first minimum value of the ratios of the distances between the first display position and the second display position and the horizontal border of the graphical user interface and the height of the graphical user interface.
[0089] In this embodiment, the formula for calculating the first minimum value of the ratio of the distance between the first display position and the second display position and the horizontal border of the graphical user interface to the height of the graphical user interface includes:
[0090] Factor=min(Factor1',Factor2')
[0091] Factor1'=min(Factor1,1-Factor1)
[0092] Factor2'=min(Factor2,1-Factor2)
[0093] Factor1=(Py1-ScreenHeight) / ScreenHeight
[0094] Factor2=(Py2-ScreenHeight) / ScreenHeight
[0095] Among them, Py1 represents the vertical axis coordinate value of the first virtual character in the display interface coordinate system; Py2 represents the vertical axis coordinate value of the target virtual character in the display interface coordinate system; wherein the display interface coordinate system takes the upper left corner of the graphical user interface as the coordinate origin, the upper boundary of the graphical user interface as the horizontal axis, and the left boundary of the graphical user interface as the vertical axis; ScreenHeight represents the height of the graphical user interface; Factor1 represents the ratio of the vertical axis coordinate value of the first display position to the height of the display interface; Factor2 represents the ratio of the vertical axis coordinate value of the second display position to the height of the display interface; Factor1' represents the second minimum value of the ratio of the distance between the first display position and the horizontal boundary of the graphical user interface to the height of the graphical user interface; Factor2' represents the third minimum value of the ratio of the distance between the second display position and the horizontal boundary of the graphical user interface to the height of the graphical user interface; Factor represents the first minimum value of the ratio of the distance between the first display position and the second display position from the horizontal boundary of the graphical user interface to the height of the graphical user interface.
[0096] Step S406: Compare the first minimum value with a preset first ratio threshold and a preset second ratio threshold to obtain a comparison result; wherein the first ratio threshold is smaller than the second ratio threshold.
[0097] Step S408: Determine the stretching form of the viewing angle of the preset virtual lens according to the comparison result; the stretching form includes zooming out, zooming in, and no stretching.
[0098] In at least one possible implementation, the stretching form of the viewing angle orientation of the virtual lens is determined in the following manner:
[0099] If the first minimum value is less than the first ratio threshold, or if the first display position of the first virtual character or the second display position of the target virtual character is not within the range of the graphical user interface, it is determined that the stretching form of the viewing angle of the virtual lens is to be zoomed out. That is, if the first virtual character or the target virtual character is at a relatively remote position of the graphical user interface (for example, jumping at a higher position in the air), or the first virtual character or the target virtual character is out of the range of the graphical user interface, it is necessary to zoom out the viewing angle of the virtual lens to achieve the effect of reducing the game scene screen, so as to display the first virtual character and the target virtual character in a relatively central position area of the graphical user interface.
[0100] If the first minimum value is greater than the second ratio threshold, it is determined that the stretching form of the viewing angle of the virtual lens is zoomed in. That is, if the first virtual character or the target virtual character is located too centrally in the graphical user interface (e.g., too close to each other), the viewing angle of the virtual lens needs to be zoomed in to achieve the effect of enlarging the game scene screen.
[0101] If the first minimum value is greater than the first ratio threshold value and less than the second ratio threshold value, it is determined that the stretching form of the viewing angle of the virtual lens is not stretched. At this time, the first virtual character and the target virtual character are in a relatively suitable position in the graphical user interface, and the player can better obtain the current battle information without zooming in or out the game screen presented at the current viewing angle, so the viewing angle of the virtual lens is not stretched.
[0102] In actual operation, the graphical user interface may be partitioned to determine the stretching form of the viewing angle of the virtual lens according to the partition into which the display positions of the first virtual character and the target virtual character in the graphical user interface fall.
[0103] See also Figure 5 , which is a schematic diagram of dividing the graphical user interface into regions. Figure 5 In the manner shown, the graphical user interface 32 is divided into a plurality of areas, wherein the area near the upper and lower boundaries of the interface is the lens zoom-out area 51, and the area near the middle of the interface is the lens zoom-in area 52. When the display position of the first virtual character or the target virtual character in the interface falls into the lens zoom-out area 51, the stretching form of the viewing angle of the virtual lens is determined to be zoom-out; when the display position of the first virtual character or the target virtual character in the interface falls into the lens zoom-in area 52, the stretching form of the viewing angle of the virtual lens is determined to be zoom-in; when the first virtual character or the target virtual character is in the area between the lens zoom-out area 51 and the lens zoom-in area 52, the lens viewing angle of the virtual lens is not stretched.
[0104] Step S410: Calculate the stretching distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold and the second ratio threshold.
[0105] In one possible implementation manner, the stretching distance can be calculated by the following steps 11-12:
[0106] (11) If the stretching form is zooming out, the zooming distance of the lens viewing angle of the virtual lens is calculated according to the first minimum value, the first ratio threshold value, and the preset lens stretching speed and lens smoothing time.
[0107] In this embodiment, a formula for calculating the zoom distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold, a preset lens stretching speed, and a lens smoothing time includes:
[0108] Dist 远 =Factor*DistSpeed*DeltaTime / SmoothTime
[0109] If the first minimum value is less than the first ratio threshold, Factor is equal to the first minimum value; if the first display position of the first virtual character or the second display position of the target virtual character is not within the range of the graphical user interface, Factor is equal to the first ratio threshold; Dist 远 Indicates the distance of the lens angle of view of the virtual lens; DistSpeed indicates the preset lens stretching speed; SmoothTime indicates the preset lens smoothing time; DeltaTime indicates the time taken by the virtual lens to generate a frame of image.
[0110] (12) If the stretching form is zooming in, the zooming distance of the lens angle of view of the virtual lens is calculated according to the first minimum value, the second ratio threshold, the lens stretching speed and the lens smoothing time.
[0111] In this embodiment, if the stretching form is zooming in, the formula for calculating the zooming distance of the lens angle of view of the virtual lens according to the first minimum value, the second ratio threshold, the lens stretching speed and the lens smoothing time includes:
[0112] Dist 近 =(Factor-MaxFactor)*DistSpeed*DeltaTime / SmoothTime
[0113] Among them, Dist 近 Indicates the zoom-in distance of the lens angle of view of the virtual lens; MaxFactor indicates the second ratio threshold; Factor indicates the first minimum value; DistSpeed indicates the lens stretching speed; SmoothTime indicates the lens smoothing time; DeltaTime indicates the time taken by the virtual lens to generate a frame of image.
[0114] Step S412: Calculate the target viewing angle of the virtual lens according to the stretching form, the stretching distance and the current viewing angle of the virtual lens.
[0115] For example, assuming that it is determined through the above steps that the stretching form of the current adjustment of the virtual lens is to zoom out, and the stretching distance is 10 meters in the game scene coordinates, then according to the current viewing angle of the virtual lens, the target viewing angle of the virtual lens can be calculated as: 10 meters backward from the current viewing angle.
[0116] In this way, through the above-mentioned implementation method of this embodiment, the stretching adjustment of the lens angle of the virtual lens can be automatically triggered to avoid the situation where, during the battle, either party suddenly moves into the air, causing one party to be at the edge of the lens or even leave the lens, thereby allowing both parties to appear on the game screen.
[0117] In actual operation, when the virtual lens is in the automatically stretched lens angle, a corresponding condition for exiting the lens angle stretching may be set. In one possible implementation, if it is detected that the first virtual character or the target virtual character attacked in the air has landed, and the landing time exceeds a preset third time threshold, the lens angle of the virtual lens is restored to the angle of view before the stretching.
[0118] For example, assuming that the above-mentioned third time threshold is 3 seconds, within 3 seconds after the first virtual character or target virtual character that triggers the virtual lens stretching lands, the lens stretching algorithm can be automatically triggered to release, thereby restoring the lens angle of the virtual lens to the angle of view before stretching.
[0119] The method for adjusting the camera angle of view in the game provided by this embodiment can automatically trigger the stretching processing of the virtual camera angle of view, so as to achieve the effect of zooming in to magnify the game screen, and zooming out to display a larger range of the game screen. This method can alleviate the situation where one of the two opponents is at the edge of the camera or even leaves the camera, so that both sides of the game are presented in the game screen.
[0120] In actual game operation, if the virtual lens has both lens angle offset (lens centering) and lens angle stretching, the time interval between triggering the release of lens angle offset and lens angle stretching is short in some scenes. If the horizontal and near changes of the lens angle are performed in a short time, the player will feel that the lens is abnormal, and there may be a bug, resulting in a bad experience. In order to alleviate this problem, this embodiment introduces another method of adjusting the lens angle in the game, and the specific method is as follows.
[0121] In one possible implementation, if the current viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a second trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before the offset is met, a first satisfaction degree of a first trigger condition for restoring the virtual lens to the viewing angle before the stretching is determined; if the first satisfaction degree reaches a preset first degree requirement, the lens viewing angle of the virtual lens is restored to the preset viewing angle.
[0122] The first satisfaction degree of the first trigger condition for restoring the virtual lens to the viewing angle before stretching can be determined through the following steps 21-22:
[0123] (21) if it is detected that the first virtual character or the target virtual character that was attacked into the air has landed, calculate a first ratio of the duration of landing to the third time threshold;
[0124] (22) The first ratio is determined as a first degree of satisfaction of a first trigger condition for restoring the virtual lens to the viewing angle orientation before stretching.
[0125] For example, assuming that the second trigger condition for restoring the lens angle of the virtual lens to the angle of view before the offset is: after the virtual lens is adjusted to the lens angle of the center lens, if the first virtual character does not hit the target virtual character again within 8 seconds, the lens angle of the virtual lens is restored to the angle of view before the offset. And, determining the first ratio as the first trigger condition for restoring the virtual lens to the angle of view before the stretch is: if it is detected that the first virtual character or the target virtual character attacked in the air has landed for more than 5 seconds, the lens angle of the virtual lens is restored to the angle of view before the stretch.
[0126] Then, in a scenario where the current viewing angle is both offset and stretched compared to the preset viewing angle, if the virtual lens is adjusted to the viewing angle of a centered lens, and the first virtual character does not hit the target virtual character again within 8 seconds, then if it is detected that the current landing time of the first virtual character that was attacked into the air is 4 seconds, the corresponding first satisfaction degree is calculated to be 80% (4 divided by 5). If the preset first degree requirement is: the satisfaction degree is required to be more than 70%, then the first satisfaction degree meets the first degree requirement at this time, and the viewing angle of the virtual lens is restored to the preset viewing angle.
[0127] In another possible implementation, if the viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a first trigger condition for restoring the viewing angle of the virtual lens to the viewing angle before the stretching is met, a second degree of satisfaction of a second trigger condition for restoring the virtual lens to the viewing angle before the offset is determined; if the second degree of satisfaction reaches a preset second degree requirement, the lens viewing angle of the virtual lens is restored to the preset viewing angle.
[0128] The second satisfaction degree of the second trigger condition for restoring the virtual lens to the viewing angle before the offset can be determined through the following steps 31-32:
[0129] (31) calculating a second ratio of the duration during which the first virtual character does not hit the target virtual character again to the second time threshold;
[0130] (32) The second ratio is determined as a second degree of satisfaction of a second trigger condition for restoring the virtual lens to the viewing angle orientation before the offset.
[0131] In this way, the method for adjusting the camera angle of view in the game provided by this embodiment alleviates the problem that when the symmetrical lens and the stretched lens are released at a close time, the player feels that there is something wrong with the lens, resulting in a bad experience. It optimizes the automatic adjustment method of the camera angle of view and improves the gaming experience.
[0132] In order to solve the problem that the virtual lens is blocked by other objects in the scene, this embodiment also provides another method for adjusting the lens angle in the game, in which a graphical user interface is provided by a terminal device, and the graphical user interface displays a game scene, and the game scene includes a first virtual character. Figure 6 As shown, it is a flow chart of another method for adjusting the camera angle in a game, wherein the method comprises the following steps:
[0133] Step S602: Obtain a first position of the first virtual character in the game scene.
[0134] Here, step S602 in this embodiment corresponds to step S102 in the above embodiment. For the description of the corresponding contents, reference may be made to the corresponding parts of the above embodiment, which will not be described again.
[0135] Step S604: Determine whether there is an obstacle between the first virtual character and a preset virtual lens according to the first position.
[0136] In one possible implementation, it is possible to determine whether there is an obstacle between the virtual lens and the first virtual character based on the first position and the third position of the virtual lens in the game scene through a ray detection algorithm.
[0137] Specifically, a ray can be emitted to the first position with the third position of the virtual lens in the game scene as the starting point of the ray. If a collision is detected between the third position and the first position, it is determined that there is an obstacle between the virtual lens and the first virtual character; otherwise, it is determined that there is no obstacle between the virtual lens and the first virtual character.
[0138] Step S606: If there is an obstacle, determine the target viewing angle of the virtual lens according to the first position, and adjust the lens viewing angle of the virtual lens from the current viewing angle to the target viewing angle.
[0139] If it is determined that there is an obstacle between the virtual lens and the first virtual character, it is determined that a lens angle adjustment event is triggered. Here, in at least one possible implementation, the above method of determining the target angle of view of the virtual lens can be implemented by the following steps 41-42:
[0140] (41) determining the position where the ray detects the collision as the position where the obstacle is located;
[0141] (42) The position before the position where the obstacle is located is determined as the target viewing angle of the virtual lens.
[0142] Step S608: Determine the game scene in the graphical user interface according to the target viewing angle.
[0143] Here, step S608 corresponds to step S106 in the aforementioned embodiment. For the description of the corresponding contents, reference may be made to the corresponding parts of the aforementioned embodiment, which will not be repeated here.
[0144] In this way, when there is an obstacle between the virtual lens and the first virtual character, the above method can automatically adjust the lens angle of the virtual lens to the front of the obstacle to avoid the virtual lens being blocked by the obstacle, so that a picture with richer battle information can be captured and presented to the player.
[0145] like Figure 7 As shown, it is a schematic diagram of lens angle adjustment in a scene where a virtual lens is blocked provided by an embodiment of the present invention, wherein the virtual lens is preset at a fixed relative position behind the first virtual character 71 controlled by the player, that is, corresponding to the third position mentioned above. When the virtual lens captures each frame of image, a ray is emitted to the first position with the lens angle orientation as the ray starting point. When the ray detects an obstacle 72, a lens angle adjustment event is triggered, and the lens angle of the virtual lens is automatically adjusted to the front of the obstacle 72 shown in the figure.
[0146] The method for adjusting the camera angle in a game provided by this embodiment can alleviate the situation where the virtual camera in the game is blocked by objects in the scene, and automatically adjust the camera angle of the virtual camera to move it in front of the obstacle to avoid being blocked by it.
[0147] Corresponds to Figure 1 The embodiment of the present invention further provides a device for adjusting the camera angle in a game, wherein the device provides a graphical user interface through a terminal device, and the graphical user interface displays a game scene, and the game scene includes a first virtual character 71 and a target virtual character. Figure 8 , which is a schematic diagram of the structure of a device for adjusting the camera angle in a game, Figure 8 It can be seen that the device includes a position acquisition module, a target viewing angle determination module 82 and a first game scene determination module 83 which are connected in sequence, wherein the functions of each module are as follows:
[0148] A first position acquisition module 81, for responding to a lens adjustment event, acquiring a first position of the first virtual character in the game scene and a second position of the target virtual character in the game scene;
[0149] A target viewing angle determination module 82 is used to determine a target viewing angle of a preset virtual lens according to the first position and the second position, and adjust the lens viewing angle of the virtual lens from a current viewing angle to the target viewing angle;
[0150] The first game scene determination module 83 is used to determine the game scene in the graphical user interface according to the target viewing angle.
[0151] An embodiment of the present invention provides a device for adjusting the lens angle in a game. In response to a lens adjustment event, the first position of the first virtual character in the game scene and the second position of the target virtual character in the game scene are obtained; according to the first position and the second position, the target angle of view of the preset virtual lens is determined, and the lens angle of the virtual lens is adjusted from the current angle of view to the target angle of view; and the game scene in the graphical user interface is determined according to the target angle of view. In the device, the lens angle of the virtual lens is automatically adjusted according to the position information of the first virtual character and the target virtual character, so as to present more abundant battle information to the player, and can alleviate problems such as the virtual lens being blocked and the target virtual character leaving the lens screen. This method simplifies the player's switching operation for the lens angle and improves the game experience.
[0152] In one possible implementation, the lens adjustment event includes at least one of the following: determining that the first virtual character hits the target virtual character, and the time from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold; determining that the target virtual character is attacked into the air; determining that the first virtual character is attacked into the air, and the current viewing angle of the virtual lens is offset relative to the preset viewing angle.
[0153] In another possible implementation, when the lens adjustment event is to determine that the first virtual character hits the target virtual character, and the time from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold, the target viewing angle orientation determination module 82 is further used to: calculate the first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculate the second display position of the target virtual character projected onto the graphical user interface according to the second position; calculate the total lens viewing angle offset of the preset virtual lens according to the first display position and the second display position; calculate the lens viewing angle offset distance of the virtual lens when shooting the current image frame according to the total lens viewing angle offset and the preset smoothing time of the virtual lens; and determine the target viewing angle orientation of the virtual lens when shooting the current image frame according to the preset viewing angle orientation and the lens viewing angle offset distance.
[0154] In another possible implementation, the device further includes a lens recovery module, which is used to restore the lens angle of the virtual lens to the perspective orientation before the offset if the first virtual character does not hit the target virtual character again within a preset second time threshold after the lens angle of the virtual lens is adjusted from the current perspective orientation to the target perspective orientation.
[0155] In another possible implementation, when the lens adjustment event is to determine that the target virtual character is attacked into the air, or to determine that the first virtual character is attacked into the air, and the current viewing angle of the virtual lens is offset from the preset viewing angle, the target viewing angle determination module 82 is further used to: calculate the first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculate the second display position of the target virtual character projected onto the graphical user interface according to the second position; calculate a first minimum value of the ratio of the distance between the first display position and the second display position and the horizontal boundary of the graphical user interface and the height of the graphical user interface; compare the first minimum value with a preset first ratio threshold and a preset second ratio threshold to obtain a comparison result; wherein the first ratio threshold is less than the second ratio threshold; determine a stretching form for the viewing angle of the preset virtual lens according to the comparison result; the stretching form includes zooming out, zooming in, and not stretching; calculate the stretching distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold, and the second ratio threshold; calculate the target viewing angle of the virtual lens according to the stretching form, the stretching distance, and the current viewing angle of the virtual lens.
[0156] In another possible implementation, the target viewing angle orientation determination module 82 is further used to: if the first minimum value is less than the first ratio threshold, or if the first display position of the first virtual character or the second display position of the target virtual character is not within the range of the graphical user interface, determine that the stretching form of the viewing angle orientation of the preset virtual lens is zooming out; if the first minimum value is greater than the second ratio threshold, determine that the stretching form of the viewing angle orientation of the virtual lens is zooming in; if the first minimum value is greater than the first ratio threshold and less than the second ratio threshold, determine that the stretching form of the viewing angle orientation of the virtual lens is not stretching.
[0157] In another possible implementation, the target viewing angle orientation determination module 82 is further used to: if the stretching form is zooming out, calculate the zooming distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold and the preset lens stretching speed and lens smoothing time; if the stretching form is zooming in, calculate the zooming distance of the lens viewing angle of the virtual lens according to the first minimum value, the second ratio threshold, the lens stretching speed and the lens smoothing time.
[0158] In another possible implementation, the lens recovery module is also used to restore the lens perspective of the virtual lens to the perspective orientation before stretching if it is detected that the first virtual character or the target virtual character attacked into the air has landed and the landing time exceeds a preset third time threshold.
[0159] In another possible implementation, the lens restoration module is further used for: if the current viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a second trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before the offset is met, determining a first satisfaction degree of a first trigger condition for restoring the virtual lens to the viewing angle before the stretching; if the first satisfaction degree reaches a preset first degree requirement, restoring the lens viewing angle of the virtual lens to the preset viewing angle.
[0160] In another possible implementation, the lens recovery module is further used to: if it is detected that the first virtual character or the target virtual character that was attacked into the air has landed, calculate a first ratio of the duration of landing to the third time threshold; and determine the first ratio as a first degree of satisfaction of a first trigger condition for restoring the virtual lens to the viewing angle before stretching.
[0161] In another possible implementation, the lens restoration module is further used for: if the viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a first trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before stretching is met, determining a second degree of satisfaction of a second trigger condition for restoring the virtual lens to the viewing angle before the offset; if the second degree of satisfaction reaches a preset second degree requirement, restoring the lens viewing angle of the virtual lens to the preset viewing angle.
[0162] In another possible implementation, the lens restoration module is further used to: calculate a second ratio of the duration during which the first virtual character fails to hit the target virtual character again to the second time threshold; and determine the second ratio as a second degree of satisfaction of a second trigger condition for restoring the virtual lens to the viewing angle before the offset.
[0163] The device for adjusting the camera angle of view in a game provided by an embodiment of the present invention has the same implementation principle and technical effects as those of the embodiment of the method for adjusting the camera angle of view in the aforementioned game. For the sake of brief description, for parts not mentioned in the embodiment of the device for adjusting the camera angle of view in a game, reference may be made to the corresponding contents in the embodiment of the method for adjusting the camera angle of view in the aforementioned game.
[0164] Corresponds to Figure 6 The present invention also provides another device for adjusting the camera angle in a game, wherein the device provides a graphical user interface through a terminal device, and the graphical user interface displays a game scene, and the game scene includes a first virtual character and a target virtual character. Fig. 9 , which is a schematic diagram of the structure of another device for adjusting the camera angle in a game, Fig. 9It can be seen that the device includes a second position acquisition module 91, an obstacle determination module 92, a viewing angle adjustment module 93 and a second game scene module 94 which are connected in sequence, wherein the functions of each module are as follows:
[0165] A second position acquisition module 91 is used to acquire a first position of the first virtual character in the game scene;
[0166] An obstacle determination module 92 is used to determine whether there is an obstacle between the first virtual character and a preset virtual lens according to the first position;
[0167] A viewing angle orientation adjustment module 93, configured to determine a target viewing angle orientation of the virtual lens according to the first position if an obstacle exists, and adjust the lens viewing angle of the virtual lens from a current viewing angle orientation to the target viewing angle orientation;
[0168] The second game scene module 94 is used to determine the game scene in the graphical user interface according to the target viewing angle.
[0169] In one possible implementation manner, the obstacle determination module 92 is further used to determine whether there is an obstacle between the virtual lens and the first virtual character through a ray detection algorithm according to the first position and a third position of the virtual lens in the game scene.
[0170] In another possible implementation, the obstacle determination module 92 is further used to: use the third position of the virtual lens in the game scene as the starting point of the ray, send a ray to the first position, and if the ray detects a collision between the third position and the first position, determine that there is an obstacle between the virtual lens and the first virtual character.
[0171] In another possible implementation, the obstacle determination module 92 is further configured to: determine the position where the ray detects collision as the position of the obstacle; and determine the position before the position of the obstacle as the target viewing angle of the virtual lens.
[0172] The device for adjusting the camera angle of view in a game provided by an embodiment of the present invention has the same technical features as the method for adjusting the camera angle of view in a game provided by the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.
[0173] The embodiment of the present invention further provides an electronic device, such as Fig.10 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 101 and a memory 102, the memory 102 stores machine executable instructions that can be executed by the processor 101, and the processor 101 executes the machine executable instructions to implement the method for adjusting the camera angle in the above-mentioned game.
[0174] exist Fig.10 In the illustrated embodiment, the electronic device further includes a bus 103 and a communication interface 104 , wherein the processor 101 , the communication interface 104 and the memory 102 are connected via the bus.
[0175] The memory 102 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 104 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.10 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0176] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 101 or the instruction in the form of software. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, register, or other mature storage media in the art. The storage medium is located in the memory, and the processor 101 reads the information in the memory 102, and combines its hardware to complete the steps of the method for adjusting the camera angle in the game in the above embodiment.
[0177] An embodiment of the present invention also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for adjusting the lens angle in the above-mentioned game. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.
[0178] The method for adjusting the lens angle of view in a game, the device for adjusting the lens angle of view in a game, and the computer program product of an electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method for adjusting the lens angle of view in a game described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0179] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0180] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0181] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0182] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for adjusting the camera angle in a game, characterized in that: A graphical user interface is provided by a terminal device, wherein the graphical user interface displays a game scene, wherein the game scene includes a first virtual character and a target virtual character, and the method includes: In response to the lens adjustment event, obtaining a first position of the first virtual character in the game scene and a second position of the target virtual character in the game scene; Determine a target viewing angle of a preset virtual lens according to the first position and the second position, and adjust the lens viewing angle of the virtual lens from a current viewing angle to the target viewing angle; Determining a game scene in the graphical user interface according to the target viewing angle; The lens adjustment event includes at least one of the following: determining that the first virtual character hits the target virtual character, and the time from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold; determining that the target virtual character is attacked into the air; determining that the first virtual character is attacked into the air, and the current viewing angle of the virtual lens is offset relative to the preset viewing angle; When the lens adjustment event is to determine that the first virtual character hits the target virtual character, and the time length from the current moment to the moment when the first virtual character first hits the target virtual character in the current attack reaches a preset first time threshold, the step of determining the target viewing angle orientation of the preset virtual lens according to the first position and the second position includes: calculating the first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating the second display position of the target virtual character projected onto the graphical user interface according to the second position; calculating the total lens viewing angle offset of the preset virtual lens according to the first display position and the second display position; calculating the lens viewing angle offset distance of the virtual lens when shooting the current image frame according to the total lens viewing angle offset and the preset smoothing time of the virtual lens; determining the target viewing angle orientation of the virtual lens when shooting the current image frame according to the preset viewing angle orientation and the lens viewing angle offset distance; When the lens adjustment event is to determine that the target virtual character is attacked into the air, or to determine that the first virtual character is attacked into the air and the current viewing angle of the virtual lens is offset from the preset viewing angle, the step of determining the target viewing angle of the preset virtual lens according to the first position and the second position includes: calculating the first display position of the first virtual character projected onto the graphical user interface according to the first position, and calculating the second display position of the target virtual character projected onto the graphical user interface according to the second position; calculating the first minimum value of the ratio of the distance between the first display position and the second display position and the horizontal boundary of the graphical user interface and the height of the graphical user interface; comparing the first minimum value with a preset first ratio threshold and a second ratio threshold to obtain a comparison result; wherein the first ratio threshold is less than the second ratio threshold; determining the stretching form of the viewing angle of the preset virtual lens according to the comparison result; the stretching form includes zooming out, zooming in and not stretching; calculating the stretching distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold and the second ratio threshold; calculating the target viewing angle of the virtual lens according to the stretching form, the stretching distance and the current viewing angle of the virtual lens.
2. The method according to claim 1, characterized in that: After the step of adjusting the lens viewing angle of the virtual lens from the current viewing angle position to the target viewing angle position, the method further comprises: If the first virtual character does not hit the target virtual character again within a preset second time threshold after adjusting the lens angle of the virtual lens from the current angle of view to the target angle of view, the lens angle of the virtual lens is restored to the angle of view before the offset.
3. The method according to claim 1, characterized in that The step of determining the stretching form of the viewing angle orientation of the preset virtual lens according to the comparison result comprises: If the first minimum value is less than the first ratio threshold, or if the first display position of the first virtual character or the second display position of the target virtual character is not within the range of the graphical user interface, determining that the stretching form of the viewing angle of the preset virtual lens is zooming out; If the first minimum value is greater than the second ratio threshold, determining that the stretching form of the viewing angle orientation of the virtual lens is zooming in; If the first minimum value is greater than the first ratio threshold and less than the second ratio threshold, it is determined that the stretching form of the viewing angle orientation of the virtual lens is not stretched.
4. The method according to claim 1, characterized in that: The step of calculating the stretching distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold and the second ratio threshold comprises: If the stretching form is zooming out, calculating the zooming distance of the lens viewing angle of the virtual lens according to the first minimum value, the first ratio threshold, a preset lens stretching speed, and a lens smoothing time; If the stretching form is zooming in, the zooming distance of the lens viewing angle of the virtual lens is calculated according to the first minimum value, the second ratio threshold, the lens stretching speed, and the lens smoothing time.
5. The method according to claim 1, characterized in that After the step of adjusting the lens viewing angle of the virtual lens to the target viewing angle orientation, the method further comprises: If it is detected that the first virtual character or the target virtual character attacked into the air has landed, and the landing time exceeds a preset third time threshold, the lens angle of the virtual lens is restored to the angle of view before stretching.
6. The method according to claim 5, characterized in that The method further comprises: If the current viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a second trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before the offset is satisfied, determining a first satisfaction degree of a first trigger condition for restoring the virtual lens to the viewing angle before the stretching; If the first satisfaction degree reaches a preset first degree requirement, the lens viewing angle of the virtual lens is restored to a preset viewing angle orientation.
7. The method according to claim 6, characterized in that The step of determining a first satisfaction degree of a first trigger condition for restoring the virtual lens to a viewing angle before stretching comprises: If it is detected that the first virtual character or the target virtual character attacked into the air has landed, a first ratio of the duration of landing to the third time threshold is calculated; The first ratio is determined as a first satisfaction degree of a first trigger condition for restoring the virtual lens to a viewing angle orientation before stretching.
8. The method according to claim 2, characterized in that: The method further comprises: If the viewing angle of the virtual lens is both offset and stretched compared to the preset viewing angle, when a first trigger condition for restoring the lens viewing angle of the virtual lens to the viewing angle before the stretching is satisfied, determining a second satisfaction degree of a second trigger condition for restoring the virtual lens to the viewing angle before the offset; If the second satisfaction degree reaches a preset second degree requirement, the lens viewing angle of the virtual lens is restored to a preset viewing angle orientation.
9. The method according to claim 8, characterized in that The step of determining a second degree of satisfaction of a second trigger condition for restoring the virtual lens to the viewing angle before the offset comprises: Calculate a second ratio of the duration during which the first virtual character does not hit the target virtual character again to the second time threshold; The second ratio is determined as a second degree of satisfaction of a second trigger condition for restoring the virtual lens to a viewing angle orientation before the offset.
10. A method for adjusting the camera angle in a game, characterized in that: A graphical user interface is provided by a terminal device, wherein the graphical user interface displays a game scene, wherein the game scene includes a first virtual character, and the method includes: Obtaining a first position of the first virtual character in the game scene; Determining whether there is an obstacle between the first virtual character and a preset virtual lens according to the first position; If there is an obstacle, determining a target viewing angle of the virtual lens according to the first position, and adjusting the lens viewing angle of the virtual lens from a current viewing angle to the target viewing angle; A game scene in the graphical user interface is determined according to the target viewing angle.
11. The method according to claim 10, characterized in that The step of determining whether there is an obstacle between the first virtual character and a preset virtual lens according to the first position includes: According to the first position and the third position of the virtual lens in the game scene, a ray detection algorithm is used to determine whether there is an obstacle between the virtual lens and the first virtual character.
12. The method according to claim 11, characterized in that The step of determining whether there is an obstacle between the virtual lens and the first virtual character by using a ray detection algorithm according to the first position and the third position of the virtual lens in the game scene comprises: A ray is emitted to the first position with the third position of the virtual lens in the game scene as the ray starting point. If a collision is detected between the third position and the first position, it is determined that there is an obstacle between the virtual lens and the first virtual character.
13. The method according to claim 12, characterized in that The step of determining the target viewing angle orientation of the virtual lens according to the first position comprises: Determine the position where the ray detects a collision as the position where the obstacle is located; The position before the position where the obstacle is located is determined as the target viewing angle orientation of the virtual lens.
14. An electronic device, characterized in that: The electronic device includes a processor and a memory, the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method for adjusting the camera angle in a game as described in any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the method for adjusting the camera angle in the game as described in any one of claims 1 to 13.
