Method and device for switching camera movement mode, storage medium, and electronic device
By detecting the virtual game scene status and switching the camera movement mode of the virtual camera, the problem in the existing technology of being unable to switch the camera movement mode according to the game situation is solved, thereby improving the immersion and sense of substitution in the virtual game, and improving the user experience.
Patent Information
- Application Number
- CN202010602687.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-29
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-06-29
AI Technical Summary
In the existing technology, the virtual camera cannot switch the camera mode according to the game situation in the game, resulting in a lack of immersion and substitution in the user experience. Especially in key scenes such as BOSS battles, it cannot follow and trigger camera special effects in real time, which affects the quality of the game picture.
By detecting the scene state of the virtual game, if the specified scene is entered, the virtual camera is controlled to switch from the first camera mode to the second camera mode, for example, from the free perspective mode to the area mode or the specific lens mode, and the source camera parameters are used to initialize the second camera mode. Second, move the camera mode and calculate the looking point of the virtual camera to focus on the specified game object.
It realizes switching the camera mode according to the game situation, improves the immersion and sense of substitution in virtual games, improves the user experience, and provides smoother and more stable game images especially in key scenes.
Smart Images

Figure CN111760286B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for switching camera movement modes, a storage medium, and an electronic device. Background Art
[0002] In the related art, with the development of computer technology and the diversification of terminal functions, more and more types of games can be realized on terminals and other devices, such as racing, sandbox, role-playing game (RPG) and shooting games, etc. In the game, controlling the virtual camera can control the user's perspective and the game screen.
[0003] In the related technologies, the game screen is either completely controlled by the players themselves or completely controlled by the game strategy. The modes are not comprehensive enough. The disadvantage of free control is that it cannot quickly focus on key information. For example, when fighting a boss, the boss's movement route is difficult to predict, and the operation of the handle is not as flexible as a mouse. It may shake randomly and cannot follow the boss in real time. For example, in key scenes such as large monster executions, the camera special effects cannot be triggered freely, and the game screen lacks immersion and sense of substitution. For online games, this will cause the position of the monster viewed by third parties to jump.
[0004] With respect to the above-mentioned problems existing in the related technologies, no effective solutions have been found so far. Summary of the invention
[0005] Embodiments of the present invention provide a method and device for switching a camera movement mode, a storage medium, and an electronic device.
[0006] According to one embodiment of the present invention, a method for switching camera modes is provided, comprising: when a virtual camera of a virtual game adopts a first camera mode to present a game screen, detecting a scene state of the virtual game; if the scene state indicates that the virtual game enters a specified scene, controlling the virtual camera to switch from the first camera mode to a second camera mode.
[0007] Optionally, detecting the scenario state of the virtual game includes: detecting the movement position of the main control character in the game screen at preset intervals in the main loop of the virtual game, and / or monitoring the plot content of the virtual game according to the logical strategy of the virtual game.
[0008] Optionally, if the scenario state represents that the virtual game enters a specified scenario, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes at least one of the following: if the scenario state represents that the main control character of the virtual game moves to a specified position, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode; if the scenario state represents that the virtual game plays a game screen with a specified plot, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode.
[0009] Optionally, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes: saving source camera parameters of the first camera movement mode; and adjusting the first camera movement mode to the second camera movement mode using the source camera parameters as initialization parameters of the second camera movement mode.
[0010] Optionally, adjusting the first camera movement mode to the second camera movement mode using the source camera parameters as the initialization parameters of the second camera movement mode includes: obtaining the lens position and lens orientation of the first camera movement mode at the last moment in the initialization parameters; using the lens position and the lens orientation as the initial position and initial orientation of the second camera movement mode, respectively, to control the virtual camera to switch the game screen.
[0011] Optionally, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes one of the following: controlling the virtual camera to switch from a free view mode to an area mode, wherein the area mode is a camera movement mode in which the virtual camera continuously focuses on a specified game object; controlling the virtual camera to switch from a free view mode to a specific lens mode, wherein the specific lens mode is a camera movement mode in which the virtual camera continuously plays a specified plot.
[0012] Optionally, after controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode, in the second camera movement mode, the method further includes: locating a first coordinate point C of a designated non-player-controlled character (NPC) character in the virtual map, a second position point H of a main control character in the game scene, and a third position point A where the main control character locks onto the target; calculating the position of a look point F of the virtual camera in the virtual map based on the first coordinate point C, the second position point H, and the third position point A, wherein the look point is on the line connecting the first coordinate point and the second position point.
[0013] Optionally, calculating the position of the viewing point F of the virtual camera in the virtual map according to the first coordinate point C, the second position point H, and the third position point A includes: calculating the fourth position point B of the first intermediate point by a preset weight, wherein B is located on the line CA; and calculating the length of the line segment CE by the following formula: The length of line segment EF is calculated by the following formula: Arctan(L AE / L EF )–arctan(L BD / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, D is the vertical point of the line connecting point B to CH; L is extended from point C to point H CE +L EF The length of gets the position of the look-at point F in the virtual map.
[0014] According to another embodiment of the present invention, a device for switching camera modes is provided, comprising: a detection module for detecting a scene state of a virtual game when a virtual camera of the virtual game adopts a first camera mode to present a game screen; and a switching module for controlling the virtual camera to switch from the first camera mode to a second camera mode if the scene state indicates that the virtual game enters a specified scene.
[0015] Optionally, the detection module includes: a detection unit, used to detect the movement position of the main control character in the game screen at preset intervals in the main loop of the virtual game, and / or monitor the plot content of the virtual game according to the logical strategy of the virtual game.
[0016] Optionally, the switching module includes at least one of the following: a first switching unit, used to control the virtual camera to switch from the first camera movement mode to the second camera movement mode if the scenario state represents that the main control character of the virtual game moves to a specified position; a second switching unit, used to control the virtual camera to switch from the first camera movement mode to the second camera movement mode if the scenario state represents that the virtual game plays a game screen of a specified plot.
[0017] Optionally, the switching module includes: a saving unit, used to save source camera parameters of the first camera movement mode; and an adjustment unit, used to adjust the first camera movement mode to the second camera movement mode by using the source camera parameters as initialization parameters of the second camera movement mode.
[0018] Optionally, the adjustment unit includes: an acquisition subunit, used to obtain the lens position and lens orientation of the first camera movement mode in the initialization parameters at the last moment; and a control subunit, used to control the virtual camera to switch the game screen with the lens position and the lens orientation as the initial position and initial orientation of the second camera movement mode, respectively.
[0019] Optionally, the switching module includes one of the following: a fourth switching unit, used to control the virtual camera to switch from a free perspective mode to an area mode, wherein the area mode is a camera movement mode in which the virtual camera continuously focuses on a specified game object; a fifth switching unit, used to control the virtual camera to switch from a free perspective mode to a specific lens mode, wherein the specific lens mode is a camera movement mode in which the virtual camera continuously plays a specified plot.
[0020] Optionally, the device also includes: a positioning module, which is used to locate the first coordinate point C of a designated non-player controlled character (NPC) character in the virtual map, the second position point H of the main control character in the game scene, and the third position point A where the main control character locks the target, after the switching module controls the virtual camera to switch from the first camera movement mode to the second camera movement mode, in the second camera movement mode; and a calculation module, which is used to calculate the position of the look point F of the virtual camera in the virtual map based on the first coordinate point C, the second position point H, and the third position point A, wherein the look point is on the line connecting the first coordinate point and the second position point.
[0021] Optionally, the calculation module includes: a first calculation unit, used to calculate a fourth position point B of the first intermediate point by a preset weight, wherein B is located on the line connecting CA; and a second calculation unit, used to calculate the length of the line segment CE by the following formula: The third calculation unit is used to calculate the length of the line segment EF by the following formula: Arctan(L AE / L EF )–arctan(L BD / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, and D is the vertical point of the line connecting point B to CH; the extension unit is used to extend L from point C to point H. CE +L EF The length of gets the position of the look-at point F in the virtual map.
[0022] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0023] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0024] Through the present invention, when the virtual camera of the virtual game adopts the first camera movement mode to present the game screen, the scene state of the virtual game is detected. If the scene state represents that the virtual game enters a specified scene, the virtual camera is controlled to switch from the first camera movement mode to the second camera movement mode. By triggering the switching of different camera movement modes through the scene state of the virtual game, the virtual camera can switch the camera movement mode in different game links and states, thereby presenting different game screens, which solves the technical problem in the related art that the camera movement mode cannot be switched according to the game scene, improves the immersion and sense of substitution of the virtual game, and enhances the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 is a hardware structure block diagram of a screenshot computer according to an embodiment of the present invention;
[0027] Figure 2 is a flow chart of a method for switching a camera movement mode according to an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of selecting a camera mode according to an embodiment of the present invention;
[0029] Figure 4 is a schematic diagram of calculating a look point in a regional mode according to an embodiment of the present invention;
[0030] Figure 5 4 is a structural block diagram of a device for switching camera movement modes according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only embodiments of a part of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0033] Example 1
[0034] The method embodiment provided in the first embodiment of the present application can be executed in a mobile phone, tablet, computer, server or similar electronic terminal. Taking running on a computer as an example, Figure 1 FIG. 1 is a hardware structure diagram of a switching computer for a camera movement mode according to an embodiment of the present invention. Figure 1 As shown, the computer 10 may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the computer may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0035] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for switching a camera mode in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer 10 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. In this embodiment, the processor 104 is used to respond to human-computer interaction instructions and game strategies, and control the target virtual character to perform a specified operation to complete a game task. The memory 104 is used to store program scripts, configuration information, attribute information of virtual characters, etc. of electronic games.
[0036] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0037] Optionally, the input-output device 108 also includes a human-computer interaction screen for obtaining human-computer interaction instructions through a human-computer interaction interface, and for presenting game screens in game tasks;
[0038] In this embodiment, a method for switching the camera movement mode is provided. Figure 2 is a flow chart of a method for switching a camera movement mode according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0039] Step S202, when the virtual camera of the virtual game adopts the first camera movement mode to present the game screen, detecting the scene state of the virtual game;
[0040] The camera mode (also called camera mode) of this embodiment refers to the way the virtual camera moves (including static state) when presenting the game screen. Based on different movement or residence methods, it can selectively present game screens with different perspectives, different fields of view, and different contents.
[0041] Optionally, the scenario state of this embodiment may be the progress state of the game plot based on the game strategy, the control state of objects (characters, props, maps, levels, etc.) in the virtual game scene based on the main control character, etc. The virtual game of this embodiment may be an online electronic game of role control type such as a massively multiplayer online game (MMORPG).
[0042] Step S204, if the scene state indicates that the virtual game has entered a specified scene, the virtual camera is controlled to switch from the first camera movement mode to the second camera movement mode;
[0043] Optionally, a second camera movement mode matching the current scene state may be selected from a plurality of camera movement modes according to a preset configuration table (including a mapping relationship between scene states and camera movement modes);
[0044] Through the above steps, when the virtual camera of the virtual game adopts the first camera movement mode to present the game screen, the scene state of the virtual game is detected. If the scene state represents that the virtual game enters the specified scene, the virtual camera is controlled to switch from the first camera movement mode to the second camera movement mode. By triggering the switching of different camera movement modes through the scene state of the virtual game, the virtual camera can switch the camera movement mode in different game links and states, thereby presenting different game pictures, which solves the technical problem that the camera movement mode cannot be switched according to the game scene in the related technology, improves the immersion and sense of substitution of the virtual game, and enhances the user experience.
[0045] In this embodiment, the virtual game includes multiple camera movement modes, which correspond to different scene states. The following are examples of different camera movement modes:
[0046] UI mode: interface operation when previewing products, fashions, and pets;
[0047] Free perspective: The main player can freely control the game screen through remote sensing, handles, etc.
[0048] Traditional 3D: Use keyboard and mouse to freely operate and control the game screen;
[0049] Special perspective mode (specific lens mode): When executing specific game characters (such as special monsters, big bosses and other hostile characters), in order to enhance the performance, the camera movement route created by the artist is divided into the starting stage, the movement stage, and the ending stage. The starting stage is when the camera smoothly transitions to the starting point of the route specified by the artist according to the player's actions. In the movement stage, the camera moves in accordance with the artist's production and in coordination with the player's actions. In the ending stage, the camera smoothly transitions to the starting position of the camera mode before switching.
[0050] Area mode: The game camera always focuses on a certain game object, and the virtual camera is controlled by an algorithm. Players cannot operate it. The algorithm automatically calculates the current key view based on the weights of multiple attraction fields, and smoothes it over, repeating it continuously in the loop of the main game process.
[0051] Horizontal mode: special copy requirements, such as the interface of a 2D horizontal game, where players can only control the forward and backward movement of the character or the plot;
[0052] Story CG (Computer Graphics) mode: Game cutscenes, plot animations through frame-by-frame pictures (with text).
[0053] Each of the above-mentioned camera movement modes includes one or more functional modules, and each camera movement mode may include several identical basic modules, such as the delayed follow function, which is a functional module that all modes have. The functional modules are freely combined to form a mode according to specific needs, and the development of functional modules can be reused. In one example, the functional modules in this embodiment include: customized camera movement routes, configurable parameter overlay, key information aggregation, free control, strategic managed focus, smooth transition, instantaneous cut lens, inertial follow, multi-field attraction, and boundary limitation. Figure 3 It is a schematic diagram of selecting a camera mode according to an embodiment of the present invention. A camera movement mode kit is generated according to the functional module assembly, and then a corresponding camera mode is switched to be executed based on the current scene state through a scene selector.
[0054] In one implementation of the present embodiment, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode may be, but is not limited to: controlling the virtual camera to switch from the free view mode to the area mode, wherein the area mode is a camera movement mode in which the virtual camera continuously focuses on a specified game object; controlling the virtual camera to switch from the free view mode to the specific lens mode, wherein the specific lens mode is a camera movement mode in which the virtual camera continuously plays a specified plot.
[0055] In one implementation of this embodiment, detecting the situational state of the virtual game includes: detecting the moving position of the main control character in the game screen at preset intervals in the main loop of the virtual game, and monitoring the plot content of the virtual game according to the logical strategy of the virtual game.
[0056] In one implementation of the present embodiment, if the scenario state represents that the virtual game enters a specified scenario, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode may be, but is not limited to: if the scenario state represents that the main control character of the virtual game moves to a specified position, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode; if the scenario state represents that the virtual game plays a game screen with a specified plot, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode.
[0057] In this embodiment, there are multiple triggering conditions for switching the camera mode. A scene detection function can be set to perform continuous detection at fixed intervals in the main loop of the game. When a certain scene is detected, the relevant camera mode (camera mode of the virtual camera) is automatically triggered. For example, the player moves to a special coordinate to trigger the area mode. It can also be actively triggered according to the game logic, calling the interface in a certain logic branch to enter the target camera mode. For example, when executing a large monster, the free view mode automatically enters the special lens mode, and the execution action is played and then automatically switches back to the free view mode.
[0058] In this embodiment, when controlling the camera movement mode to switch, a smooth transition of the screen can be performed to avoid the jump and freeze of the game screen. Controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes:
[0059] S11, saving source camera parameters of the first camera movement mode;
[0060] S12: adjusting the first camera movement mode to the second camera movement mode by using the source camera parameters as initialization parameters of the second camera movement mode.
[0061] In some embodiments, adjusting the first camera movement mode to the second camera movement mode using the source camera parameters as the initialization parameters of the second camera movement mode includes: obtaining the lens position and lens orientation of the first camera movement mode at the last moment in the initialization parameters; using the lens position and lens orientation as the initial position and initial orientation of the second camera movement mode, respectively, to control the virtual camera to switch the game screen.
[0062] This embodiment saves the camera parameters of the previous mode as the parameters for initializing the next camera mode. When the next camera mode is started, the parameters of the previous camera can be used directly, or the parameters of the previous camera can be used for a smooth transition. These assignments or smooth transitions are all done automatically and do not require player operation, so players are completely unaware when playing the game. For example, if the player is currently in free perspective mode and the character enters a special area that triggers the regional mode of the key boss, the camera will automatically be taken over by the program and smoothly transition from the current perspective to the perspective of the boss. Free and seamless switching of the game screen is achieved, which is smooth and smooth.
[0063] In this embodiment, after the virtual camera is controlled to switch from the first camera movement mode to the second camera movement mode, in the second camera movement mode, the second camera movement mode is run and the game screen is presented based on the second camera movement mode. Taking the second camera movement mode as the area mode as an example, the screen presentation process of the area mode includes:
[0064] S21, locating a first coordinate point C of a designated non-player character (NPC) in a virtual map, a second position point H of a main control character in a game scene, and a third position point A where the main control character locks onto a target; optionally, the designated NPC may be a game character that can bring attribute gains, or the last obstacle to clearing a game level (such as a final boss), or may be an enemy character in a confrontation state, such as an online enemy player character;
[0065] S22, calculating the position of the viewing point F of the virtual camera in the virtual map according to the first coordinate point C, the second position point H, and the third position point A, wherein the viewing point is on the line connecting the first coordinate point and the second position point.
[0066] The viewing point of this embodiment and the position point (image acquisition point) of the virtual camera in the entire game scene can present the game screen of the corresponding perspective by calculating the viewing point and movement trajectory of the virtual camera.
[0067] In some examples, the position of the virtual camera's viewing point F in the virtual map is calculated based on the first coordinate point C, the second position point H, and the third position point A, including: calculating the fourth position point B of the first intermediate point by a preset weight, where B is located on the line CA; and calculating the length of the line segment CE by the following formula: The length of line segment EF is calculated by the following formula: Arctan(L AE / L EF )–arctan(L BD / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, D is the vertical point of the line connecting point B to CH; L is extended from point C to point H CE +L EF The length of gets the position of the look-at point F in the virtual map.
[0068] Figure 4 This is a schematic diagram of calculating the look-to point in the regional mode of an embodiment of the present invention. The final screen effect is that the target locked by the protagonist (may not exist) and a specific object in the virtual game (such as Boss) are within the camera range. C is the Boss point, H is the point where the main control protagonist is located, assuming that the camera look-to point is located at a point on the straight line CH, point F is the camera look-to point, and point B is obtained according to the weight configured by the planner. When the angle AFB is half fov (Field of View), the target location point just enters the field of view. Therefore, the length of CF can be calculated to know the position of the camera.
[0069] During the calculation process, the position of point B is calculated first. The specific position of point B is:
[0070] CA*(1–boss’ weight), boss’ weight + target’s weight = 1 (the weights of multiple points are attraction weights, and the viewing point is ultimately determined by multiple weights);
[0071] In addition, the angle ACF is calculated by arccos(dot(vector CA, vector CH)), the length of line segment CE = the magnitude of vector AC * cos angle ACF;
[0072] It can be seen that the line segment EF can be derived from the following formula: Arctan(AE / EF)–arctan(BD / (DE+EF))=halfHFov.
[0073] Finally, CE+EF is the distance from the camera's viewing point to the Boss. The coordinates of the Boss and the protagonist are known, and the camera's viewing point is on the straight line connecting the protagonist and the Boss, so the camera's coordinate point is obtained. By updating the positions of the above points F and CF frame by frame, a dynamic game screen based on the regional mode can be presented.
[0074] Through the scheme of this embodiment, game developers can develop different functional modules according to needs, freely assemble them into specific camera modes, and seamlessly switch according to strategies in different game scenarios. In some complex scenes, such as the boss battle of the key plot, the algorithm can accurately control the multi-scene attraction. In the absence of special needs, it can return to the free perspective mode of most mmo games and let the players control it themselves. The scheme has strong scalability, comprehensive functions, and stable operation, providing a better sense of immersion for heavy mmo games.
[0075] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0076] Example 2
[0077] In this embodiment, a switching device for the camera movement mode is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0078] Figure 5 is a structural block diagram of a switching device for a mirror movement mode according to an embodiment of the present invention. Figure 5 As shown, the device includes: a detection module 50, a switching module 52, wherein:
[0079] A detection module 50, configured to detect a scene state of the virtual game when the virtual camera of the virtual game presents the game screen in a first camera movement mode;
[0080] The switching module 52 is used to control the virtual camera to switch from the first camera movement mode to the second camera movement mode if the scenario state indicates that the virtual game enters a specified scenario.
[0081] Optionally, the detection module includes: a detection unit, used to detect the movement position of the main control character in the game screen at preset intervals in the main loop of the virtual game, and / or monitor the plot content of the virtual game according to the logical strategy of the virtual game.
[0082] Optionally, the switching module includes at least one of the following: a first switching unit, used to control the virtual camera to switch from the first camera movement mode to the second camera movement mode if the scenario state represents that the main control character of the virtual game moves to a specified position; a second switching unit, used to control the virtual camera to switch from the first camera movement mode to the second camera movement mode if the scenario state represents that the virtual game plays a game screen of a specified plot.
[0083] Optionally, the switching module includes: a saving unit, used to save source camera parameters of the first camera movement mode; and an adjustment unit, used to adjust the first camera movement mode to the second camera movement mode by using the source camera parameters as initialization parameters of the second camera movement mode.
[0084] Optionally, the adjustment unit includes: an acquisition subunit, used to obtain the lens position and lens orientation of the first camera movement mode in the initialization parameters at the last moment; and a control subunit, used to control the virtual camera to switch the game screen with the lens position and the lens orientation as the initial position and initial orientation of the second camera movement mode, respectively.
[0085] Optionally, the switching module includes one of the following: a fourth switching unit, used to control the virtual camera to switch from a free perspective mode to an area mode, wherein the area mode is a camera movement mode in which the virtual camera continuously focuses on a specified game object; a fifth switching unit, used to control the virtual camera to switch from a free perspective mode to a specific lens mode, wherein the specific lens mode is a camera movement mode in which the virtual camera continuously plays a specified plot.
[0086] Optionally, the device also includes: a positioning module, which is used to locate the first coordinate point C of a designated non-player controlled character (NPC) character in the virtual map, the second position point H of the main control character in the game scene, and the third position point A where the main control character locks the target, after the switching module controls the virtual camera to switch from the first camera movement mode to the second camera movement mode, in the second camera movement mode; and a calculation module, which is used to calculate the position of the look point F of the virtual camera in the virtual map based on the first coordinate point C, the second position point H, and the third position point A, wherein the look point is on the line connecting the first coordinate point and the second position point.
[0087] Optionally, the calculation module includes: a first calculation unit, used to calculate a fourth position point B of the first intermediate point by a preset weight, wherein B is located on the line connecting CA; and a second calculation unit, used to calculate the length of the line segment CE by the following formula: The third calculation unit is used to calculate the length of the line segment EF by the following formula: Arctan(L AE / L EF )–arctan(L BD / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, and D is the vertical point of the line connecting point B to CH; the extension unit is used to extend L from point C to point H. CE +L EF The length of gets the position of the look-at point F in the virtual map.
[0088] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.
[0089] Example 3
[0090] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.
[0091] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0092] S1, when a virtual camera of a virtual game presents a game screen in a first camera movement mode, detecting a scene state of the virtual game;
[0093] S2: If the scenario state indicates that the virtual game has entered a specified scenario, control the virtual camera to switch from the first camera movement mode to a second camera movement mode.
[0094] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0095] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0096] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0097] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0098] S1, when a virtual camera of a virtual game presents a game screen in a first camera movement mode, detecting a scene state of the virtual game;
[0099] S2: If the scenario state indicates that the virtual game has entered a specified scenario, control the virtual camera to switch from the first camera movement mode to a second camera movement mode.
[0100] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.
[0101] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0102] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0103] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0104] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0105] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0106] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable 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 method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0107] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for switching a camera movement mode, characterized in that: include: When a virtual camera of the virtual game presents a game screen in a first camera movement mode, detecting a scene state of the virtual game; If the scenario state indicates that the virtual game has entered a specified scenario, controlling the virtual camera to switch from the first camera movement mode to a second camera movement mode; In the second camera movement mode, a first coordinate point C of a designated non-player controlled character NPC character in a virtual map is located, a second position point H of a main control character in a game scene is located, and a third position point A of a target is locked by the main control character; The fourth position point B of the first middle point is calculated by the preset weight, where B is located on the line connecting CA; the length of the line segment CE is calculated by the following formula: The length of line segment EF is calculated by the following formula: Arctan(L AE / L EF )-arctan(L BD / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, D is the vertical point of the line connecting point B to CH; L is extended from point C to point H CE +L EF The length of gets the position of the look-at point F in the virtual map.
2. The method according to claim 1, characterized in that: Detecting the situation state of the virtual game includes: In the main loop of the virtual game, the moving position of the main control character in the game screen is detected at preset intervals, and / or the plot content of the virtual game is monitored according to the logical strategy of the virtual game.
3. The method according to claim 1, characterized in that If the scenario state indicates that the virtual game enters a specified scenario, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes at least one of the following: If the scenario state indicates that the main control character of the virtual game moves to a specified position, controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode; If the scenario state represents a game screen of the virtual game playing a specified plot, the virtual camera is controlled to switch from the first camera movement mode to the second camera movement mode.
4. The method according to claim 1, characterized in that: Controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes: Saving the source camera parameters of the first camera movement mode; The first camera movement mode is adjusted to the second camera movement mode by using the source camera parameters as initialization parameters of the second camera movement mode.
5. The method according to claim 4, characterized in that Adjusting the first camera movement mode to the second camera movement mode by using the source camera parameter as the initialization parameter of the second camera movement mode includes: Obtaining the lens position and lens orientation of the first lens movement mode at the last moment in the initialization parameters; The lens position and the lens orientation are respectively used as the initial position and initial orientation of the second camera movement mode, and the virtual camera is controlled to switch the game screen.
6. The method according to claim 1, characterized in that Controlling the virtual camera to switch from the first camera movement mode to the second camera movement mode includes one of the following: Controlling the virtual camera to switch from a free viewing angle mode to an area mode, wherein the area mode is a camera movement mode in which the virtual camera continuously focuses on a specified game object; The virtual camera is controlled to switch from a free viewing angle mode to a specific lens mode, wherein the specific lens mode is a camera movement mode in which the virtual camera continuously plays a specified plot.
7. A device for switching camera modes, characterized in that: include: A detection module, used for detecting the scene state of the virtual game when the virtual camera of the virtual game adopts the first camera movement mode to present the game screen; A switching module, configured to control the virtual camera to switch from the first camera movement mode to a second camera movement mode if the scenario state indicates that the virtual game enters a specified scenario; a positioning module, configured to locate, after the switching module controls the virtual camera to switch from the first camera movement mode to the second camera movement mode, a first coordinate point C of a designated non-player controlled character NPC character in a virtual map, a second position point H of a main control character in a game scene, and a third position point A of a target locked by the main control character in the second camera movement mode; a calculation module, configured to calculate the position of a look-toward point F of the virtual camera in the virtual map according to the first coordinate point C, the second position point H, and the third position point A, wherein the look-toward point is on a line connecting the first coordinate point and the second position point; The calculation module includes: a first calculation unit, used to calculate the fourth position point B of the first middle point by a preset weight, wherein B is located on the line connecting CA; a second calculation unit, used to calculate the length of the line segment CE by the following formula: The third calculation unit is used to calculate the length of the line segment EF by the following formula: Arctan(L AE / L EF )-arctan(L ND / (L DE +L EF ))=1 / 2HFov, where HFov is the horizontal field of view angle looking at point F, and D is the vertical point of the line connecting point B to CH; the extension unit is used to extend L from point C to point H. CE +L EF The length of gets the position of the look-at point F in the virtual map.
8. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 6 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Game plot display method and device, electronic equipment and storage medium
CN110898429A
