Collision detection method, device, equipment, medium and program in virtual environment
By obtaining the intersection relationship between the connecting line segment of the first virtual object and the second virtual object in the virtual environment, the problem that the fast-moving virtual objects cannot interact in time is solved, and a more efficient human-computer interaction and an improved gaming experience is achieved.
Patent Information
- Application Number
- CN202211054142.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2042-08-30
AI Technical Summary
In a virtual environment, when the first virtual object moves faster, it is impossible to interact with the second virtual object in time, affecting the player's gaming experience.
By obtaining the current position point of the first virtual object and the position point after the preset time interval, connecting the two points to form a connecting line segment, and displaying the corresponding collision effect in response to the intersection relationship between the connecting line segment and the second virtual object.
When the first virtual object moves fast, it is determined whether the collision effect is displayed through the intersection relationship between the connecting line segment and the second virtual object, which helps the player to more efficiently control the interaction between the first virtual object and the second virtual object, and improve the gaming experience and human-computer interaction efficiency.
Smart Images

Figure CN115430153B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a collision detection method, device, equipment, medium and program in a virtual environment. Background Art
[0002] With the improvement of cultural and entertainment living standards, people's life experience and requirements in the virtual world are getting higher and higher. Games, as a way of expressing the virtual world, have become a channel for many people to release stress. In current game applications, players can control virtual objects to walk, run, fight and other actions in the virtual environment, and can also participate in completing various game tasks by picking up virtual props.
[0003] In the related art, the relative positions of the first virtual object and the second virtual object are usually detected in real time. When the second virtual object is within a certain preset distance of the first virtual object, the interaction effect between the first virtual object and the second virtual object is displayed. For example, when the second virtual object is a virtual prop, the pickup control of the virtual prop is displayed, or the virtual prop is illuminated.
[0004] However, when the first virtual object moves faster, even if the second virtual object was within the preset distance for interacting with the first virtual object, it will not be able to interact with the second virtual object in time, resulting in the first virtual object being unable to interact with the second virtual object within a limited time, affecting the player's gaming experience. Summary of the invention
[0005] The embodiments of the present application provide a collision detection method, device, equipment, medium and program in a virtual environment, which can make a first virtual object interact with a second virtual object that intersects with the connecting line segment as much as possible when the connecting line segment is long, thereby improving the game experience of the player and the efficiency of human-computer interaction. The technical solution is as follows.
[0006] In one aspect, a collision detection method in a virtual environment is provided, the method comprising:
[0007] Acquire a first position point of a first virtual object in a virtual scene, where the first position point is a current position point of the first virtual object in the virtual scene;
[0008] Determine a second position point of the first virtual object in the virtual scene based on the moving speed and moving direction of the first virtual object, the second position point being a position point reached by the first virtual object after moving at the moving speed in the moving direction for a preset time interval after the first position point;
[0009] Obtaining a line segment between the first position point and the second position point;
[0010] In response to an intersection relationship between the connecting line segment and a second virtual object in the virtual scene, a collision effect corresponding to the second virtual object is displayed.
[0011] On the other hand, a collision detection device in a virtual environment is provided, the device comprising:
[0012] A position point acquisition module, used to acquire a first position point of a first virtual object in a virtual scene, wherein the first position point is a current position point of the first virtual object in the virtual scene;
[0013] a position point determination module, configured to determine a second position point of the first virtual object in the virtual scene based on the moving speed and moving direction of the first virtual object, wherein the second position point is a position point reached by the first virtual object after the first position point by moving in the moving direction at the moving speed for a preset time interval;
[0014] A line segment acquisition module, which acquires a line segment connecting the first position point and the second position point;
[0015] The effect display module is used to display the collision effect corresponding to the second virtual object in response to the intersection relationship between the connecting line segment and the second virtual object in the virtual scene.
[0016] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement a collision detection method in a virtual environment as described in any of the above-mentioned embodiments of the present application.
[0017] On the other hand, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, a code set or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement a collision detection method in a virtual environment as described in any of the above-mentioned embodiments of the present application.
[0018] On the other hand, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the collision detection method in a virtual environment described in any of the above embodiments.
[0019] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0020] The first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, and the first position point and the second position point are connected to obtain a connecting line segment. When there is an intersection relationship between the connecting line segment and the second virtual object, the pick-up permission effect of the second virtual object is displayed. Avoid relying solely on the distance between the first virtual object and the second virtual object to display the pick-up permission effect indicating that the second virtual object is to be picked up. Even if the moving speed of the first virtual object is fast and the second position point reached by the first virtual object is far away from the second virtual object, the intersection relationship between the connecting line segment and the second virtual object can be used to determine whether to display the collision effect corresponding to the second virtual object, thereby assisting the player to control the first virtual object and performing a more efficient interaction process with the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 is a structural block diagram of a terminal provided by an exemplary embodiment of the present application;
[0023] Figure 2 It is a schematic diagram of an implementation environment provided by an exemplary embodiment of the present application;
[0024] Figure 3 is a flow chart of a collision detection method in a virtual environment provided by an exemplary embodiment of the present application;
[0025] Figure 4 is a flow chart of a collision detection method in a virtual environment provided by another exemplary embodiment of the present application;
[0026] Figure 5 is a schematic diagram of a collision bounding box provided by an exemplary embodiment of the present application;
[0027] Figure 6 is a schematic diagram of determining an intersection relationship provided by an exemplary embodiment of the present application;
[0028] Figure 7 is a schematic diagram of determining an intersection relationship provided by another exemplary embodiment of the present application;
[0029] Figure 8 is a schematic diagram of determining an intersection relationship provided by another exemplary embodiment of the present application;
[0030] Fig. 9 is a flow chart of a collision detection method in a virtual environment provided by another exemplary embodiment of the present application;
[0031] Fig.10 is a flow chart of a collision detection method in a virtual environment provided by another exemplary embodiment of the present application;
[0032] Fig.11 is a judgment flow chart of a collision detection method in a virtual environment provided by an exemplary embodiment of the present application;
[0033] Fig.12 is a schematic diagram of an interface of a collision detection method in a virtual environment provided by an exemplary embodiment of the present application;
[0034] Fig.13 is an interface schematic diagram of a collision detection method in a virtual environment provided by another exemplary embodiment of the present application;
[0035] Fig.14 is a judgment flow chart of a collision detection method in a virtual environment provided by another exemplary embodiment of the present application;
[0036] Fig.15 is a structural diagram of a collision detection device in a virtual environment provided by an exemplary embodiment of the present application;
[0037] Fig.16 It is a terminal structure block diagram provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0039] First, a brief introduction is given to the terms involved in the embodiments of the present application.
[0040] Virtual world: is a virtual scene displayed (or provided) when the application is running on the terminal. The virtual scene is a semi-simulated and semi-fictitious virtual environment, or a purely fictitious virtual environment. The virtual scene is any one of a two-dimensional virtual scene, a 2.5-dimensional virtual scene or a three-dimensional virtual scene, and this application does not limit this. For example, the virtual scene includes the sky, land, ocean, etc., and the land includes environmental elements such as deserts and cities. Users can control virtual objects to move in the virtual scene. Of course, the virtual scene also includes virtual items, such as projectiles, buildings, vehicles, and props required for virtual objects in the virtual scene to equip themselves or interact with other virtual objects. The virtual scene can also be used to simulate real environments under different weather conditions, such as sunny days, rainy days, foggy days or night weather. A variety of scene elements enhance the diversity and authenticity of virtual scenes.
[0041] Virtual object: refers to a virtual character that can be moved in a virtual scene. The movable object is a virtual person, a virtual animal, a cartoon character, etc. The virtual object is a virtual image in the virtual scene that is used to represent the user. The virtual scene includes multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene. Optionally, the virtual object is a character controlled by operation on the client, or an artificial intelligence (AI) set in a virtual environment through training, or a non-player character (NPC) set in a virtual scene. Optionally, the virtual object is a virtual character that competes in a virtual scene. Optionally, the number of virtual objects in the virtual scene is preset, or is dynamically determined according to the number of clients joining the virtual scene, and the embodiments of the present application are not limited to this.
[0042] Virtual props: refers to props that can be used by virtual objects in virtual scenes. Taking shooting games as an example, shooting games are provided with throwing props, virtual launchers, virtual projectiles and other shooting props, wherein the virtual projectile is the object fired by the virtual launcher when performing a firing operation, and throwing props and shooting props can cause damage to the virtual objects that are hit. Skill props such as virtual chips are also provided, which can grant the equipped virtual objects corresponding operating permissions. Virtual props can also assist virtual objects in achieving certain purposes. For example, virtual smoke bombs can assist virtual objects in concealing their bodies. It should be noted that the embodiments of the present application do not limit the types of virtual props.
[0043] In the related art, the relative position of the first virtual object and the second virtual object is usually detected in real time, and when the second virtual object is within a certain preset distance of the first virtual object, the interaction effect between the first virtual object and the second virtual object is displayed, for example, when the second virtual object is a virtual prop, the pick-up control of the virtual prop is displayed, or the virtual prop is in a light-emitting state. However, when the first virtual object moves faster, even if the second virtual object is within the preset distance that can interact with the first virtual object, it will not be able to interact with the second virtual object in time, so that the first virtual object cannot interact with the second virtual object within a limited time, affecting the player's gaming experience.
[0044] In an embodiment of the present application, a collision detection method in a virtual environment is provided, which can display a second virtual object that intersects with the connecting line segment as much as possible when the connecting line segment is long, thereby improving the player's gaming experience and the efficiency of human-computer interaction. The collision detection method in a virtual environment obtained through training in the present application can be applied to a variety of game scenarios such as mobile game scenarios and terminal game scenarios, and the embodiments of the present application do not limit this.
[0045] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the location point data involved in this application are all obtained with full authorization.
[0046] Figure 1 The electronic device 100 includes an operating system 120 and an application 122 .
[0047] The operating system 120 is the underlying software that provides application programs 122 with secure access to the computer's hardware.
[0048] The application 122 is an application that supports a virtual environment. Optionally, the application 122 is an application that supports a three-dimensional virtual environment. The application 122 can be any one of a virtual reality application, a three-dimensional map program, an auto chess game, a puzzle game, a third-person shooting game (TPS), a first-person shooting game (FPS), a multiplayer online tactical competitive game (MOBA), and a multiplayer gunfight survival game. The application 122 can be a stand-alone application, such as a stand-alone three-dimensional game program, or a network-connected application.
[0049] Next, the implementation environment involved in the embodiments of the present application is described. For illustration, please refer to Figure 2 The implementation environment involves a terminal 210 , a server 220 and a communication network 230 , wherein the terminal 210 and the server 220 are connected via the communication network 230 .
[0050] The terminal 210 runs a target application supporting a virtual environment. Schematically, the terminal 210 displays a virtual scene through the target application, and the virtual scene includes a first virtual object, a second virtual object, etc. After obtaining a first position point of the first virtual object in the virtual scene, a second position point reached by the first virtual object after moving in a moving direction at a moving speed for a preset time interval is obtained, and a connecting line segment between the first position point and the second position point is determined according to the first position point and the second position point, and the data resource of the connecting line segment is transmitted to the server 220, and the server 220 determines whether to display a display result of a collision effect corresponding to the second virtual object according to the intersection relationship between the connecting line segment and the second virtual object in the virtual scene, and feeds back the display result to the terminal 210, and when the display result indicates that the terminal 210 displays the collision effect corresponding to the second virtual object, the collision effect corresponding to the second virtual object is displayed on the interface of the terminal 210, thereby indicating that the first virtual object interacts with the second virtual object.
[0051] It is worth noting that the above-mentioned terminals include but are not limited to mobile terminals such as mobile phones, tablet computers, portable laptops, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, and can also be implemented as desktop computers, etc.; the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers, or they can be cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0052] Among them, cloud technology refers to a hosting technology that unifies a series of resources such as hardware, applications, and networks within a wide area network or local area network to achieve data computing, storage, processing, and sharing.
[0053] In some embodiments, the above server can also be implemented as a node in a blockchain system.
[0054] In combination with the above-mentioned noun introduction and application scenarios, the collision detection method in the virtual environment provided by the present application is described, and the method is applied to the terminal as an example. Figure 3 As shown, the method includes the following steps 310 to 340.
[0055] Step 310: Acquire a first position point of a first virtual object in a virtual scene.
[0056] The first position point is the current position point of the first virtual object in the virtual scene.
[0057] Illustratively, the first virtual object is a virtual character controlled by the player, for example, the first virtual object is a virtual wizard controlled by the player; or, the first virtual object is a virtual pet controlled by the player; or, the first virtual object is a combat hero riding on a virtual mount controlled by the player, etc.
[0058] Optionally, the terminal runs a game application, and after opening the game application, it displays a virtual scene corresponding to the game, such as a virtual battlefield scene, a virtual town scene, a desert scene, etc. The virtual scene includes at least one of a first virtual object controlled by a player, a virtual ground for the first virtual object to move, a virtual sky for improving the realism of the virtual scene, a virtual city wall, a virtual ocean, a virtual building, and other virtual elements.
[0059] Schematically, in a virtual scene, a world coordinate system is established with a preset point as the origin of the world coordinate system and straight lines with a pairwise perpendicular relationship as the axes of the world coordinate system. The position point of the first virtual object controlled by the player at the current moment in the world coordinate system is determined, and the position point is used as the first position point. For example: the position coordinates of the first virtual object in the world coordinate system corresponding to the virtual scene are determined, and the position coordinates are used as the first position point coordinates, that is, the position information of the first position point in the virtual scene is determined according to the position coordinates of the first virtual object at the current moment.
[0060] Alternatively, in a virtual scene, an object coordinate system is established with the position of the first virtual object controlled by the player at the current moment as the origin, that is, the origin of the object coordinate system is the first position point of the first virtual object in the virtual scene; or, different screen coordinate systems are determined based on the pixel difference of the terminal displaying the virtual scene interface. For example: the terminal displaying the virtual scene interface is a computer, and the display pixels of the computer screen are used as the unit, the lower left corner of the computer screen is determined as the origin, and the length and width of the computer screen and the "camera" in the virtual scene are used as axes to establish a screen coordinate system, and then the position point of the first virtual object at the current moment in the screen coordinate system is determined, and this position point is used as the first position point.
[0061] Step 320: Determine a second position point of the first virtual object in the virtual scene based on the moving speed and moving direction of the first virtual object.
[0062] In an optional embodiment, the moving speed and moving direction of the first virtual object are determined based on the player's control over the first virtual object.
[0063] Schematically, in a terminal game scenario, the player controls the first virtual object through external devices such as a keyboard, mouse, and game controller. For example: the player controls the movement of the first virtual object in the virtual scene through the designated keys on the keyboard (such as: A key, → key, etc.); or, the player controls the first virtual object to perform a normal attack by clicking the left mouse button; or, the player controls the change of the direction of the first virtual object by moving the left mouse button; or, the player controls the first virtual object to move in the corresponding direction (i.e., move in the moving direction) through the direction adjustment control on the game controller. Optionally, the player can also control the movement speed, movement mode, etc. of the first virtual object by long pressing the designated keys on the keyboard, such as: long pressing the A key to control the first virtual object to accelerate in the "left direction", long pressing the space bar to control the first virtual object to complete the jump operation, etc.
[0064] Schematically, in a mobile game scenario, the player controls the first virtual object through the terminal screen, game controller and other devices. Optionally, the game screen displayed by the terminal includes a direction control, and the player controls the first virtual object to move in the corresponding direction in the virtual scene (i.e., move in the moving direction) by sliding the direction control, wherein the moving speed is usually implemented as the default moving speed of the first virtual object. Optionally, the player can also control the moving speed of the first virtual object through the direction control, such as: long pressing the direction control along the moving direction to control the first virtual object to accelerate in the moving direction. Among them, the moving speed of accelerated running is greater than the default moving speed of the first virtual object when the direction control is not long pressed, and the default moving speed and the moving speed of accelerated running are the moving speeds of the first virtual object in different situations.
[0065] Optionally, a "flash control" is displayed on the screen corresponding to the terminal, and based on the player's triggering operation of the "flash control" through a mouse, keyboard, trigger, etc., the first virtual object is controlled to accelerate and run in the direction of the first virtual object. For example, the player clicks the "flash control" with the mouse to realize the triggering operation of the "flash control"; or the player clicks the preset shortcut key position on the keyboard (such as: the preset shortcut function of flashing through the O key position) to realize the triggering operation of the "flash control"; or the player clicks the "flash control" on the screen to realize the triggering operation of the "flash control", etc.
[0066] Alternatively, the virtual shoes in the virtual scene are virtual props that increase the moving speed of the first virtual object. In response to the player equipping the first virtual object with the virtual shoes, the first virtual object accelerates its running in the virtual scene; or the virtual backpack in the virtual scene is a virtual prop that slows down the moving speed of the first virtual object. In response to the player equipping the first virtual object with the virtual backpack, the first virtual object decelerates its movement in the virtual scene, etc. Among them, the moving speed of accelerated running, the moving speed of decelerated movement, etc. are the moving speeds of the first virtual object in different situations.
[0067] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0068] In an optional embodiment, the moving speed and moving direction of the first virtual object are determined based on a default setting of the system.
[0069] Indicatively, the default configuration of the system is "when the first virtual object does not move within a preset time, the first virtual object is automatically controlled to move in the virtual scene". For example: the preset time is 5 minutes, when the terminal is running the game application, when it is detected that the first virtual object has not moved within 5 minutes, the first virtual object is automatically controlled to move toward the teammate at a default moving speed; or, when it is detected that the first virtual object has not moved within 5 minutes, the first virtual object is automatically controlled to move to the right direction in an accelerated running manner, etc.
[0070] The second position point is a position point reached by the first virtual object after the first position point when the first virtual object moves in the moving direction at a moving speed for a preset time interval.
[0071] Optionally, after the first position point, based on the player's control of the first virtual object, the first virtual object moves at a speed controlled by the player and in a direction controlled by the player, and the position point reached by the first virtual object after a preset time interval is used as the second position point.
[0072] For example, the preset time interval is 0.1 seconds, and the player controls the first virtual object to accelerate and run toward the southeast. The position point reached by the first virtual object after moving toward the southeast direction (moving direction) at the accelerated running speed for 0.1 seconds is taken as the second position point.
[0073] Optionally, after the first position point, the control process of the first virtual object is implemented based on the system default configuration, so that the first virtual object moves in the system default moving direction based on the system default moving speed, and the position point reached by the first virtual object after a preset time interval is used as the second position point.
[0074] For example: the preset time interval is 1 second. When the terminal detects that the player has not controlled the first virtual object within 3 minutes (the preset time length configured by the system by default), the terminal automatically controls the first virtual object to move in the direction of the teammates at a default moving speed, and takes the position point reached by the first virtual object after moving in the direction of the teammates (moving direction) at the default moving speed for 1 second as the second position point.
[0075] In an optional embodiment, the position information of the second position point is determined by the position coordinates of the first virtual object in the virtual scene.
[0076] Illustratively, the center point of the first virtual object is determined, and the position coordinates of the center point corresponding to the first virtual object in the virtual scene are used as the position coordinates of the second position point; or, the position coordinates of the first virtual object on a virtual plane in the virtual scene are determined, and the position coordinates are used as the position coordinates of the second position point, etc.
[0077] Optionally, in the virtual scene, a world coordinate system is established with a preset point as the origin of the world coordinate system and straight lines with a pairwise perpendicular relationship as the axes of the world coordinate system. Determine the position coordinates of the first virtual object controlled by the player in the world coordinate system after the first position point, after moving in the moving direction at a moving speed for a preset time interval, and use the position coordinates as the second position point of the first virtual object in the virtual scene.
[0078] Alternatively, in a virtual scene, an object coordinate system is established with the first position point of the first virtual object controlled by the player as the origin, and the position coordinates reached by the first virtual object after moving at a moving speed in a moving direction at a preset time interval after the first position point are determined, and the position coordinates are used as the second position point.
[0079] Alternatively, based on the terminal pixel information displaying the virtual scene interface, a screen coordinate system is established to determine the position coordinates reached by the first virtual object after the first position point, after moving in the moving direction at a moving speed for a preset time interval, and use the position coordinates as the second position point, etc.
[0080] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0081] Step 330: Obtain a line segment between the first position point and the second position point.
[0082] Optionally, after determining a first position point and a second position point of the first virtual object in the virtual scene, the first position point and the second position point are connected to obtain a connecting line segment between the first position point and the second position point.
[0083] Schematically, the virtual scene is implemented as a three-dimensional (3D) space, wherein the first position point is at point M in the 3D space. After the first virtual object moves in the northeast direction (moving direction) in the 3D space at a speed of 400 yards per second for 0.1 seconds, it reaches the second position point in the 3D space. The second position point is represented by point N. Points M and N are connected to obtain a connecting line segment between the first position point and the second position point.
[0084] Optionally, a world coordinate system is established according to the virtual scene, and position information of the first position point and the second position point is represented by position coordinates.
[0085] Schematically, when the virtual scene is implemented as a two-dimensional (2D) space, a two-dimensional world coordinate system is established, wherein the first position point and the second position point are represented by the x-axis and the y-axis, such as: the first position point is represented as (2, 3), the second position point is represented as (3, 5), etc.; or, when the virtual scene is implemented as a three-dimensional space, the first position point and the second position point are represented by the x-axis, the y-axis and the z-axis, such as: the first position point is represented as (2, 3, 1), the second position point is represented as (3, 6, 5), etc.
[0086] The values of the x-axis, y-axis, and z-axis corresponding to the first position point and the second position point may be the same or different, that is, the line segment between the first position point and the second position point may be parallel to the x-axis, y-axis, or z-axis, or may intersect with the x-axis, y-axis, and z-axis. The above is only an illustrative example, and the embodiments of the present application do not limit this.
[0087] Optionally, based on the first location point and the second location point, the length of a line segment connecting the first location point and the second location point is determined, that is, the distance between the first location point and the second location point in the virtual scene is determined.
[0088] Step 340 : In response to the intersection between the connecting line segment and the second virtual object in the virtual scene, displaying a collision effect corresponding to the second virtual object.
[0089] Optionally, the second virtual object includes at least one of a target virtual character and a target virtual prop in the virtual scene. Schematically, the collision effect is used to indicate the interaction between the first virtual object and the second virtual object.
[0090] In an optional embodiment, when the second virtual object is implemented as a target virtual character, in response to the intersection of the connecting line segment and the target virtual character in the virtual scene, the interaction effect between the first virtual object and the target virtual character is displayed, and the interaction effect is used as the collision effect.
[0091] Optionally, when the connecting line segment intersects with the target virtual character in the virtual scene, the first virtual object interacts with the target virtual character in different interaction modes based on the camp to which the target virtual character belongs.
[0092] Illustratively, when the connecting line segment intersects with a target virtual character in a virtual scene, if the target virtual character is an enemy virtual character, the first virtual object attacks the target virtual character; or, if the target virtual character is a friendly virtual character, the first virtual object initiates treatment of the second virtual object, etc.
[0093] Optionally, different interaction modes are determined based on the game settings of the player. For example, when the connecting line segment intersects with the target virtual character in the virtual scene, the first virtual object initiates a chat request to the target virtual character; or the first virtual object sends a synchronization request to the target virtual character.
[0094] Among them, the attack effect produced by launching an attack, the treatment effect produced by initiating treatment, the request effect produced by initiating a chat request and a synchronization request, etc. can all be used as the above-mentioned interactive effects, and the embodiments of the present application do not limit this.
[0095] In an optional embodiment, when the second virtual object is implemented as a target virtual prop, in response to an intersection relationship between the connecting line segment and the target virtual prop in the virtual scene, a collision effect corresponding to the target virtual prop is displayed.
[0096] Illustratively, when the connecting line segment intersects with the target virtual prop in the virtual scene, the first virtual object picks up the target virtual prop; or, the target virtual prop is presented as allowing the picking effect, which is used to instruct the first virtual object to pick up the target virtual prop, etc.
[0097] In an optional embodiment, taking the second virtual object as a target virtual prop as an example, the collision effect corresponding to the display of the second virtual object is described.
[0098] The virtual scene also displays multiple virtual props that assist the first virtual object in playing the game, such as virtual knives, virtual guns, virtual smoke bombs and other virtual weapons; virtual hats, virtual shoes and other virtual decorations, etc. The virtual props can assist players to better participate in the game.
[0099] Illustratively, the player controls the first virtual object to pick up virtual props in the virtual scene, thereby equipping the first virtual object with the virtual props the player needs. For example, the player controls the first virtual object to pick up virtual smoke bombs in the virtual scene, so as to use virtual smoke bombs to fight other first virtual objects (such as NPC monsters in the virtual scene, first virtual objects belonging to other teams in the virtual scene, etc.); or, the player controls the first virtual object to pick up virtual shoes in the virtual scene, so as to achieve functions such as fast running by changing virtual shoes.
[0100] Optionally, when the second virtual object is implemented as a target virtual prop existing in the virtual scene and having an intersection relationship with the connecting line segment, in response to the intersection relationship between the connecting line segment and the target virtual prop in the virtual scene, the allowed pickup effect corresponding to the target virtual prop is displayed, and the allowed pickup effect is used as the collision effect.
[0101] The pickup effect is allowed to indicate that the target virtual item is to be picked up.
[0102] Schematically, the intersection relationship is used to indicate that the connecting line segment intersects with the space corresponding to the second virtual object. For example: when the virtual scene is implemented as a 3D space, the space H of the second virtual object in the 3D space is determined, and it is determined whether the connecting line segment of the first virtual object moving from the first position point to the second position point has an intersection with the space H corresponding to the second virtual object; or, when the virtual scene is implemented as a 2D space, the area G of the second virtual object in the 2D space is determined, and it is determined whether the connecting line segment of the first virtual object moving from the first position point to the second position point has an intersection with the area G corresponding to the second virtual object.
[0103] Illustratively, when the intersection relationship is determined based on the intersection point between the connecting line segment and the second virtual object, when there is one intersection point between the connecting line segment and the second virtual object, it is determined that there is an intersection relationship between the connecting line segment and the second virtual object; or, when there are two intersection points between the connecting line segment and the second virtual object, it is determined that there is an intersection relationship between the connecting line segment and the virtual prop, etc.
[0104] In an optional embodiment, the pickup effect is allowed to be implemented as a pickup control corresponding to the target virtual prop, that is, in response to the intersection of the connecting line segment and the target virtual prop in the virtual scene, the pickup control corresponding to the target virtual prop is displayed.
[0105] In an illustrative manner, the pick-up control is implemented as a triggerable control, and the target virtual prop is picked up based on the player's trigger operation on the pick-up control on the game interface. For example, the pick-up control is a trigger control displayed in the virtual scene, for example, when the connecting line segment intersects with the target virtual prop, the trigger control is displayed next to the target virtual prop, and the target virtual prop is picked up based on the trigger operation on the trigger control.
[0106] In an optional embodiment, the name of the target virtual prop is marked in the pick-up control, and in response to receiving a voice trigger operation on the prop name, the target virtual prop is picked up.
[0107] In an illustrative manner, after the player gives a voice instruction to the name of the target virtual prop displayed in the pick-up control, the terminal implements a voice trigger operation on the prop name based on the voice instruction, thereby controlling the virtual object to pick up the target virtual prop. For example: based on the intersection relationship between the connecting line segment and the target virtual prop T, a pick-up control corresponding to the target virtual prop T is displayed in the virtual scene, and the pick-up control includes the prop name "T" of the target virtual prop T. When the terminal receives the player's voice instruction of "pick up prop T", the terminal controls the virtual object to pick up the target virtual prop T based on the voice instruction.
[0108] In an optional embodiment, the pickup effect is allowed to be implemented as a virtual special effect corresponding to the target virtual prop.
[0109] Schematically, when the connecting line segment intersects with the target virtual prop, the target virtual prop is highlighted, and the highlighted state is a schematic virtual special effect; or, the target virtual prop is displayed in a glowing state, and the glowing state is a schematic virtual special effect. Optionally, when the player triggers the target virtual prop with the virtual special effect, the target virtual prop can be picked up.
[0110] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0111] In summary, the first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, the first position point and the second position point are connected to obtain a connecting line segment, and when there is an intersection relationship between the connecting line segment and the second virtual object, the collision effect of the second virtual object is displayed. Avoid relying solely on the distance between the first virtual object and the second virtual object to display the permission to pick up the second virtual object. Even if the moving speed of the first virtual object is fast and the second position point reached by the first virtual object is far away from the second virtual object, the intersection relationship between the connecting line segment and the second virtual object can be used to determine whether to display the collision effect, thereby assisting the player to control the first virtual object and perform a more efficient interaction process with the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction.
[0112] In an optional embodiment, when determining the intersection relationship between the connecting line segment and the second virtual object, the intersection relationship is determined by the relationship between the connecting line segment and the collision detection box surrounding the second virtual object. Figure 4 As shown above Figure 3 The illustrated embodiment may also be implemented as the following steps 410 to 450 .
[0113] Step 410: Acquire a first position point of a first virtual object in a virtual scene.
[0114] The first position point is the current position point of the first virtual object in the virtual scene.
[0115] Illustratively, in the virtual scene, the first location point is determined based on the location information of the current location point of the first virtual object. For example, a rectangular coordinate system is established based on the virtual scene, the location coordinates of the current location of the first virtual object in the virtual scene are determined, and the location coordinates are used as the location information of the first location point.
[0116] Step 410 has been described in the above step 310 and will not be described again here.
[0117] Step 420: Determine a second position point of the first virtual object in the virtual scene based on the moving speed and moving direction of the first virtual object.
[0118] The second position point is a position point reached by the first virtual object after the first position point when the first virtual object moves in the moving direction at a moving speed for a preset time interval.
[0119] Schematically, the preset time interval is a pre-set time interval used to determine the second position point. For example: the position information of the first virtual object in the virtual scene is determined once every 0.1 seconds, and 0.1 seconds is used as the above-mentioned preset time interval, or 0.2 seconds, 0.3 seconds, etc. are used as the above-mentioned preset time interval, etc.; or, the position information of the first virtual object in the virtual scene is determined once every time a frame of the virtual scene is refreshed, and the time interval corresponding to 1 frame is used as the above-mentioned preset time interval, or 2 frames, 3 frames, etc. are used as the above-mentioned preset time interval, etc.
[0120] In an optional embodiment, taking the time interval corresponding to 1 frame as the above-mentioned preset time interval as an example for explanation, after determining the first position point of the first virtual object in the virtual scene at the nth frame, the second position point of the first virtual object at the n+1th frame is determined based on the moving direction and moving speed of the first virtual object.
[0121] Step 420 has been described in the above step 320, so it will not be repeated here.
[0122] Step 430: Obtain a line segment between the first position point and the second position point.
[0123] Illustratively, after determining a first position point and a second position point of the first virtual object in the virtual scene, the first position point and the second position point are connected to obtain a connecting line segment between the first position point and the second position point.
[0124] Optionally, taking the time interval corresponding to 1 frame as the preset time interval as an example, after determining the first position point of the first virtual object in the virtual scene at the nth frame, based on the moving direction and moving speed of the first virtual object, determine the second position point of the first virtual object at the n+1th frame, connect the first position point and the second position point to obtain a connecting line segment between the first position point and the second position point, and the connecting line segment is used to indicate the moving distance of the first virtual object from the nth frame to the n+1th frame.
[0125] Step 430 has been described in the above step 330, so it will not be repeated here.
[0126] Step 440: Determine a collision detection box surrounding the second virtual object based on the position information of the second virtual object in the virtual scene.
[0127] The collision detection box of the second virtual object is used to indicate the collision detection box surrounding the second virtual object.
[0128] In an optional embodiment, taking the second virtual object as a target virtual prop as an example, when the second virtual object is implemented as a target virtual prop, the collision detection box of the second virtual object is used to indicate the collision detection box of the target virtual prop to be picked up.
[0129] Schematically, in a virtual scene, multiple virtual props are displayed, and the player controls the first virtual object to pick up and use the virtual props to complete game tasks, improve game levels, etc. The second virtual object is used to indicate the virtual prop to be picked up.
[0130] Optionally, multiple virtual props are distributed in different positions of the virtual scene, for example, the virtual knife K1 is located in the virtual building, the virtual knife K2 is located on the virtual table, the virtual smoke bomb B1 is located next to the virtual knife K1, etc. According to the position information of different virtual props in the virtual scene, a collision detection box surrounding the virtual props is determined.
[0131] Schematically, different virtual props correspond to different prop shapes, and the collision detection box surrounding the virtual prop is determined according to the prop shape of the virtual prop. For example, the virtual tool K1 is a long virtual prop, and the collision detection box surrounding the virtual tool K1 is determined according to the edge point of the virtual tool K1; or, the virtual smoke bomb B1 is a circular virtual prop, and the collision detection box surrounding the virtual smoke bomb B1 is determined according to the circular shape of the virtual smoke bomb B1, etc.
[0132] In an optional embodiment, the shape of the collision detection box of the second virtual object is the same as the shape of the prop of the second virtual object. Schematically, the second virtual object is a virtual gun G, and several edge points of the virtual gun G are connected to obtain an area with the same shape as the prop of the virtual gun G, and the area is used as the collision detection box corresponding to the second virtual object.
[0133] In an optional embodiment, at least one regular shape surrounding the second virtual object is determined according to the object shape of the second virtual object, and the regular shape is used as a collision detection box of the second virtual object.
[0134] In schematic form, different regular shapes are determined according to the dimensional differences of the virtual scene. For example, when the virtual scene is implemented as a 2D plane, the regular shapes include squares, rectangles, spheres, diamonds, etc.; when the virtual scene is implemented as a 3D space, the regular shapes include cubes, cuboids, spheres, etc.
[0135] Indicatively, Figure 5 As shown, the virtual scene is implemented as a 3D space as an example for explanation, the second virtual object is a virtual smoke bomb B1510, and the shape of the prop of the virtual smoke bomb B1510 is as follows Figure 5 As shown, based on the prop shape of the virtual smoke bomb B1, at least one regular shape surrounding the virtual smoke bomb B1 is determined, such as a cuboid 520 surrounding the virtual smoke bomb B1, or a sphere 530 surrounding the virtual smoke bomb B1. Optionally, the cuboid 520 surrounding the virtual smoke bomb B1 is used as a collision bounding box corresponding to the second virtual object; or the sphere 530 surrounding the virtual smoke bomb B1 is used as a collision bounding box corresponding to the second virtual object.
[0136] Optionally, when determining the collision bounding box that surrounds the second virtual object, the regular shape of the collision bounding box that just surrounds the second virtual object is determined according to the shape of the second virtual object. For example, when the second virtual object is implemented as a sphere and the regular shape of the collision bounding box that just surrounds the second virtual object is a cube, the diameter of the second virtual object is the side length of the collision bounding box.
[0137] Alternatively, when determining a collision bounding box that surrounds the second virtual object, within a certain area, a regular shape of the collision bounding box that can surround the second virtual object is arbitrarily determined. That is, it is not necessary to strictly determine the diameter, side length and other conditions of the collision bounding box based on the prop shape of the second virtual object. Instead, based on the position information of the second virtual object, within a certain area, a regular shape of the collision bounding box that can surround the second virtual object is arbitrarily determined. For example, the collision bounding box is required to surround the second virtual object and the volume of the collision bounding box is less than 1.5 times the volume of the second virtual object.
[0138] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0139] Step 450 : In response to the intersection between the connecting line segment and the collision detection box, displaying a collision effect corresponding to the second virtual object.
[0140] The collision effect is used to indicate the interaction between the first virtual object and the second virtual object.
[0141] Illustratively, after determining the line segment connecting the first position point and the second position point, and the collision detection box corresponding to the second virtual object, it is determined whether there is an intersection relationship between the line segment and the collision detection box.
[0142] Optionally, when there is an intersection relationship between the connecting line segment and the collision detection box, it means that the movement trajectory of the first virtual object within the preset time interval intersects with the collision detection box corresponding to the second virtual object, for example: the first virtual object passes the second virtual object within the preset time interval, or the first virtual object reaches the position of the second virtual object after the preset time interval, etc.
[0143] In an optional embodiment, in response to the existence of an intersection between the connecting line segment and at least one surface of the collision detection box, a collision effect corresponding to the second virtual object is displayed.
[0144] Indicatively, Figure 6 As shown, based on the first position point P1610 and the second position point P2620, the connecting line segment 630 between the first position point P1610 and the second position point P2620 is determined, and the spherical area is a collision detection box 640 corresponding to the second virtual object (not shown in the figure) in the virtual scene. After obtaining the connecting line segment 630 and the collision detection box 640, the intersection relationship between the connecting line segment 630 and the collision detection box 640 is determined, and the collision detection box 640 is obtained. Figure 6 It can be seen that there is an intersection point between the connecting line segment 630 and the surface of the collision detection box 640 . Based on the intersection point, it is determined that there is an intersection relationship between the connecting line segment 630 and the collision detection box 640 .
[0145] Indicatively, Figure 7 As shown, based on the first position point P1710 and the second position point P2720, the connecting line segment 730 between the first position point P1710 and the second position point P2720 is determined, and the cube area is a collision detection box 740 corresponding to the second virtual object (not shown in the figure) in the virtual scene. After obtaining the connecting line segment 730 and the collision detection box 740, the intersection relationship between the connecting line segment 730 and the collision detection box 740 is determined, and the collision detection box 740 is obtained. Figure 7 It can be seen that there is an intersection point between the connecting line segment 730 and the surface 741 of the collision detection box 740. Based on the intersection point, it is determined that there is an intersection relationship between the connecting line segment 730 and the collision detection box 740; or Figure 8 It can be seen that the connecting line segment 730 has an intersection with the surface 741 and the surface 742 of the collision detection box 740. Based on the two intersections, it is determined that there is an intersection relationship between the connecting line segment 730 and the collision detection box 740.
[0146] In an optional embodiment, when the second virtual object is implemented as a target virtual prop, based on the intersection relationship between the connecting line segment and the collision detection box, a pickup-allowed effect corresponding to the target virtual prop is displayed.
[0147] Illustratively, a pick-up control corresponding to the target virtual object is displayed next to the target virtual prop, and the pick-up control is used as the pickup effect allowed; or, the target virtual prop is highlighted, and the highlighted state is used as the pickup effect allowed, etc.
[0148] In an optional embodiment, a point sampling operation is performed on the connecting line segment to obtain a plurality of line segment points in the connecting line segment.
[0149] Schematically, after obtaining the connecting line segment, point sampling operation is performed on the connecting line segment at fixed intervals to obtain multiple segment points in the connecting line segment, wherein the segment length between any two adjacent segment points is the same; or, after obtaining the connecting line segment, point sampling operation is performed on the connecting line segment at random intervals to obtain multiple segment points in the connecting line segment, wherein the segment length between any two adjacent segment points may be the same or different.
[0150] Optionally, in response to at least one line segment point among the multiple line segment points being located within the collision detection box, a collision state corresponding to the second virtual object is displayed.
[0151] Illustratively, after obtaining a plurality of line segment points, the positional relationship between the plurality of line segment points and the collision detection box corresponding to the second virtual object is determined, wherein the positional relationship includes at least one of the following situations.
[0152] (1) At least one of the multiple line segment points is located within the collision detection box.
[0153] In an illustrative manner, after performing a point sampling operation on the connecting line segment, line segment point L1, line segment point L2 and line segment point L3 are obtained, and then the positional relationship between the plurality of line segment points and the collision detection box corresponding to the second virtual object is determined, and it is determined that line segment point L1 is located in the collision detection box, line segment point L2 is located on the edge of the collision detection box, and line segment point L3 is located outside the collision detection box. Optionally, the line segment point L2 located on the edge of the collision detection box is used as the line segment point located in the collision detection box.
[0154] (2) Multiple line segment points are located outside the collision detection box.
[0155] Schematically, after performing a point sampling operation on the connecting line segment, line segment point L1, line segment point L2 and line segment point L3 are obtained, and then the positional relationship between the multiple line segment points and the collision detection box corresponding to the second virtual object is judged, and it is determined that the line segment point L1, line segment point L2 and line segment point L3 are outside the collision detection box.
[0156] In an optional embodiment, when at least one line segment point among the plurality of line segment points is located within the collision detection box, it is determined that there is an intersection relationship between the connecting line segment and the collision detection box.
[0157] For example: when there is a line segment point located in the collision detection box, it is determined that the connecting line segment and the collision detection box have an intersection relationship; or when there is a line segment point located on the collision detection box, it is determined that the connecting line segment and the collision detection box have an intersection relationship, etc.
[0158] In an optional embodiment, based on a pre-set interpolation weight, an interpolation point corresponding to at least one point on the connecting line segment is obtained; in response to the interpolation point being within a collision detection box corresponding to the second virtual object, a pickup effect corresponding to the second virtual object is displayed.
[0159] Indicatively, the pre-set interpolation weight is 0.8, and when determining the interpolation point corresponding to the first position point on the connecting line segment, the coordinates of the first position point are first determined. For example, the coordinates of the first position point are (3, 6, 5), and when determining the interpolation point corresponding to the first position point, the interpolation weight is multiplied by the coordinate value, so that the coordinates of the interpolation point corresponding to the first position point are (2.4, 4.8, 4).
[0160] Illustratively, when the interpolation point coordinates are located within the area surrounded by the collision detection box corresponding to the second virtual object, the collision effect corresponding to the second virtual object is displayed.
[0161] Optionally, when the second virtual object is implemented as a target virtual prop, based on the intersection relationship, a pickup-allowed effect corresponding to the target virtual prop is displayed.
[0162] In a schematic diagram, based on the intersection relationship between the connecting line segment and the collision detection box, it is determined that the moving trajectory of the virtual object at a preset time interval intersects with the target virtual prop, and the pickup effect corresponding to the target virtual prop is displayed in the virtual scene, and the pickup effect is used to indicate the pickup of the target virtual prop. For example: when the pickup effect is presented as a pickup control corresponding to the target virtual prop, the pickup control is triggered to realize the pickup process of the target virtual prop; or, when the pickup effect is presented as a virtual special effect state with the target virtual prop, the target virtual prop is triggered to realize the pickup process of the target virtual prop.
[0163] In an optional embodiment, the second virtual object is implemented as a target virtual prop, and in response to the intersection relationship between the connecting line segment and the collision detection box, the target virtual prop corresponding to the collision detection box is automatically picked up.
[0164] In an illustrative manner, after determining that the connecting line segment intersects with the collision detection box, the terminal determines the target virtual prop corresponding to the collision detection box based on the intersection relationship, and automatically picks up the target virtual prop to realize the process of quickly picking up the target virtual prop on the moving trajectory of the virtual object.
[0165] Optionally, in response to the capacity of the virtual backpack equipped by the virtual object not reaching a preset capacity threshold, the target virtual item is automatically picked up; in response to the capacity of the virtual backpack equipped by the virtual object reaching a preset capacity threshold, the pickup effect corresponding to the target virtual item is displayed so that the player can selectively pick up the target virtual item.
[0166] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0167] In summary, the first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, the first position point and the second position point are connected to obtain a connecting line segment, and when there is an intersection relationship between the connecting line segment and the second virtual object, the collision effect of the second virtual object is displayed. Even if the movement speed of the first virtual object is fast, and the second position point reached by the first virtual object is far away from the second virtual object, it is also possible to determine whether to display the collision effect corresponding to the second virtual object through the intersection relationship between the connecting line segment and the second virtual object, thereby assisting the player to control the first virtual object and perform a more efficient interaction process with the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction.
[0168] In an embodiment of the present application, a method for judging the intersection relationship between a target first virtual object and a connecting line segment through a collision detection box of a second virtual object is introduced. Based on the position information of the second virtual object in the virtual scene, a collision detection box surrounding the second virtual object is determined. After obtaining the connecting line segment between the first position point and the second position point, the intersection relationship between the connecting line segment and the collision detection box corresponding to the second virtual object is judged. When it is determined that the connecting line segment intersects with the collision detection box, the collision effect corresponding to the second virtual object is displayed so that the player can control the first virtual object to interact with the second virtual object. As a detection box surrounding the second virtual object, the collision detection box reduces the complexity of judging the intersection relationship while reflecting the second virtual object, so that the terminal can determine the intersection relationship more quickly and accurately to realize the judgment process of whether to display the interactive effect.
[0169] In an optional embodiment, when the first virtual object moves quickly in the virtual scene, the collision detection method in the virtual environment is used to make the first virtual object interact with the second virtual object. Fig. 9 As shown above Figure 3 The illustrated embodiment may also be implemented as the following steps 910 to 940 .
[0170] Step 910: Acquire a first position point of a first virtual object in a virtual scene.
[0171] The first position point is the current position point of the first virtual object in the virtual scene.
[0172] Illustratively, in the virtual scene, the first location point is determined based on the location information of the current location point of the first virtual object. For example, a rectangular coordinate system is established based on the virtual scene, the location coordinates of the current location of the first virtual object in the virtual scene are determined, and the location coordinates are used as the location information of the first location point.
[0173] Step 910 has been described in the above step 310, so it will not be repeated here.
[0174] Step 921: In response to the moving speed of the first virtual object reaching a preset speed threshold, determine a second position point of the first virtual object in the virtual scene along the moving direction.
[0175] Illustratively, the preset speed threshold is a preset value of the movement speed of the first virtual object, and when the first virtual object starts to move in the virtual scene from the first position point, the movement speed of the first virtual object in the virtual scene is determined.
[0176] For example: determining the moving speed of the first virtual object in the virtual scene in real time; or determining the moving speed of the first virtual object in the virtual scene at equal intervals, such as: the terminal determines the moving speed of the first virtual object in the virtual scene every 0.1 seconds.
[0177] That is, when the first virtual object moves at high speed in the virtual scene, the collision detection method in the virtual environment is adopted.
[0178] In an illustrative manner, the corresponding virtual scene is displayed in the game by displaying the corresponding frame of the game. High-speed motion is used to indicate that the first virtual object passes through more frames in a short time. When the position point is acquired by using the relevant technology, a method of determining the position of the first virtual object and the second virtual object at a fixed time is usually adopted to determine the relationship between the second virtual object and the first virtual object.
[0179] However, in the above process, the positional relationship between the second virtual object and the first virtual object is usually determined once every multiple picture frames, so that when the first virtual object is moving at high speed, the multiple intermediate picture frames it passes through cannot be correctly analyzed. Even if the second virtual object exists in the multiple intermediate picture frames, the collision effect between the first virtual object and the second virtual object cannot be displayed in time, so that the first virtual object cannot interact with the second virtual object in time, affecting the detection effect of the first virtual object on the second virtual object.
[0180] By adopting the collision detection method in the above-mentioned virtual environment, the connecting line segment of the first virtual object in the virtual scene is determined, and then the passage of the connecting line segment in multiple intermediate picture frames is determined, so that the multiple picture frames passed by the connecting line segment can be taken into consideration, and the existence of the second virtual object corresponding to multiple picture frames under high-speed motion can be determined, thereby avoiding missing the collision analysis of the second virtual object.
[0181] Optionally, starting from the first position point, the moving speed of the first virtual object in the virtual scene is determined, and the moving speed is compared with a preset speed threshold. Schematically, when the moving speed reaches the preset speed threshold, the second position point reached by the first virtual object is determined along the moving direction of the first virtual object in the virtual scene.
[0182] The second position point is a position point reached by the first virtual object after the first position point when the first virtual object moves in the moving direction at a moving speed for a preset time interval.
[0183] Illustratively, when the first virtual object starts from the first position point and moves in the moving direction at a speed greater than or equal to a preset speed threshold, the second position point reached by the first virtual object after the preset time interval is determined, so as to perform a subsequent prop picking judgment process based on the second position point and the first position point; when the moving speed in the moving direction is less than the preset speed threshold, the second position point reached by the first virtual object after the preset time interval is not determined.
[0184] For example: the preset speed threshold is 3m / s, starting from the first position point, the moving speed of the first virtual object in the virtual scene is determined to be 5m / s, the moving speed is compared with the preset speed threshold, and based on the moving speed reaching the preset speed threshold, the second position point reached by the first virtual object is determined along the moving direction of the first virtual object in the virtual scene; or, starting from the first position point, the moving speed of the first virtual object in the virtual scene is determined to be 2m / s, the moving speed is compared with the preset speed threshold, and based on the moving speed being less than the preset speed threshold, the process of determining the second position point is not performed.
[0185] That is, when the movement mode of the first virtual object after the first position point is accelerated movement, the second position point is determined based on the moving speed and moving direction of the accelerated movement.
[0186] Step 922: In response to receiving a trigger operation on the acceleration control, determine a second position point of the first virtual object in the virtual scene along the moving direction.
[0187] In an exemplary embodiment, the virtual screen presented by the terminal includes an acceleration control, which is used to control the first virtual object to accelerate in the virtual scene. For example, when the player triggers the acceleration control, the first virtual object accelerates in the virtual scene. In an exemplary embodiment, the speed of the accelerated movement is greater than the default speed.
[0188] Illustratively, the acceleration control includes at least one of the controls such as a "flash control" and a "accelerated running control", which is not limited in the embodiments of the present application.
[0189] Optionally, based on the triggering operation of the acceleration control, a position point of the first virtual object after a preset time interval is determined along the moving direction of the first virtual object, and the position point is used as the second position point.
[0190] In an optional embodiment, when the first virtual object moves from the first position point to the second position point, the moving direction and the moving speed may change.
[0191] Schematically, the change in the moving direction is taken as an example for explanation. For example, after the first virtual object starts to move from the first position point, it first moves to the right direction, then moves diagonally upward, and reaches the second position point.
[0192] Schematically, the change in moving speed is taken as an example for explanation. For example, after the first virtual object starts to move from the first position point, it first moves at a moving speed of 3 m / s, then moves at a moving speed of 5 m / s, and reaches the second position point.
[0193] Step 930: Obtain a line segment between the first position point and the second position point.
[0194] Illustratively, after the first position point and the second position point are obtained through the above process, the first position point and the second position point are connected to obtain a connecting line segment between the first position point and the second position point.
[0195] In an optional embodiment, in response to the distance from the first location point to the second location point meeting a preset distance threshold, a connecting line segment between the first location point and the second location point is acquired.
[0196] Indicatively, the preset distance threshold is a pre-set distance threshold. After determining the first position point and the second position point, the distance between the first position point and the second position point in the virtual scene is determined, and the distance is compared with the preset distance threshold. For example: the distance between the first position point and the second position point is 5, the preset distance threshold is 3, based on 5>3, the connecting line segment between the first position point and the second position point is connected; or, the distance between the first position point and the second position point is 2, the preset distance threshold is 3, based on 2<3, the process of obtaining the connecting line segment is not performed.
[0197] Among them, based on the fact that the first position point and the second position point are the starting point and the end point of the movement of the first virtual object under the condition of a preset time interval, therefore, based on the distance between the first position point and the second position point and the preset time interval, the moving speed of the first virtual object can be roughly determined, and when the distance from the first position point to the second position point is compared with the preset distance threshold, when the distance from the first position point to the second position point meets the preset distance threshold, it indicates that the moving speed of the first virtual object is greater than a certain moving speed, and then the connecting line segment between the first position point and the second position point is obtained.
[0198] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0199] Step 940: In response to the intersection between the connecting line segment and the second virtual object in the virtual scene, display a collision effect corresponding to the second virtual object.
[0200] The collision effect is used to indicate the interaction between the first virtual object and the second virtual object.
[0201] Illustratively, when determining whether a connecting line segment intersects a second virtual object in a virtual scene, it is determined whether there is an intersection between the connecting line segment and the second virtual object; or, it is determined whether there is an intersection between the connecting line segment and a collision detection box corresponding to the second virtual object; or, it is determined whether a positional relationship between a segment point on the connecting line segment and the second virtual object is determined; or, it is determined whether a positional relationship between a segment point on the connecting line segment and a collision detection box corresponding to the second virtual object is determined, etc.
[0202] Optionally, in response to the existence of at least one of the above-mentioned intersection relationships between the connecting line segment and the second virtual object in the virtual scene, a collision effect corresponding to the second virtual object is displayed on the virtual screen corresponding to the terminal.
[0203] Illustratively, when there is at least one intersection point between the connecting line segment and the second virtual object, it is determined that the connecting line segment and the second virtual object have an intersection relationship, and the collision effect corresponding to the second virtual object is displayed; or, when there is at least one intersection point between the connecting line segment and the collision detection box corresponding to the second virtual object, it is determined that the connecting line segment and the second virtual object have an intersection relationship, and the collision effect corresponding to the second virtual object is displayed; or, when the line segment point on the connecting line segment is located in the second virtual object or on the edge of the second virtual object, it is determined that the connecting line segment and the second virtual object have an intersection relationship, and the collision effect corresponding to the second virtual object is displayed; or, when the line segment point on the connecting line segment is located in the collision detection box corresponding to the second virtual object or on the edge of the collision detection box, it is determined that the connecting line segment and the second virtual object have an intersection relationship, and the collision effect corresponding to the second virtual object is displayed, etc.
[0204] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0205] In an optional embodiment, the second virtual object is implemented as a target virtual prop as an example for description. In response to the intersection relationship between the connecting line segment and the target virtual prop in the virtual scene, the target virtual prop is automatically picked up.
[0206] Illustratively, when the connecting line segment intersects with the target virtual prop in the virtual scene, the terminal controls the virtual object to automatically pick up the target virtual prop.
[0207] In an optional embodiment, in response to the fact that the connecting line segment and the target virtual prop do not have an intersection relationship, the interval distance between the connecting line segment and the target virtual prop is determined; in response to the interval distance being less than a preset interval distance, the pickup effect corresponding to the target virtual prop is displayed.
[0208] Schematically, the line segment connecting the virtual object from the first position point to the second position point is located in the area corresponding to the target virtual prop. For example, the line segment connecting the virtual object from the first position point to the second position point is located in the collision detection box corresponding to the target virtual prop. Therefore, there is no intersection relationship between the line segment and the target virtual prop.
[0209] Optionally, when determining the interval distance between the connecting line segment and the target virtual prop, the interval distance between the connecting line segment and the center point of the target virtual prop is determined, for example: the interval distance between the collision detection and the center point corresponding to the connecting line segment and the target virtual prop is determined, and when the interval distance is less than a preset interval distance, the pickup effect corresponding to the target virtual prop is displayed.
[0210] In summary, the first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, and the first position point and the second position point are connected to obtain a connecting line segment. When there is an intersection relationship between the connecting line segment and the second virtual object, the collision effect of the second virtual object is displayed. Even if the moving speed of the first virtual object is fast, and the second position point reached by the first virtual object is far away from the second virtual object, the intersection relationship between the connecting line segment and the second virtual object can be used to determine whether to display the interactive effect, thereby assisting the player to control the first virtual object and perform a more efficient interactive process on the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction.
[0211] In an embodiment of the present application, an interaction process between a first virtual object and a second virtual object while moving rapidly in a virtual scene is introduced. After determining the first position point, when the moving speed of the first virtual object reaches a preset speed threshold, or a trigger operation of the acceleration control is received, the second position point of the first virtual object in the virtual scene is determined along the moving direction, and based on the connecting line segment between the first position point and the second position point, it is determined whether to display the collision effect corresponding to the second virtual object. That is: even if the moving speed of the first virtual object is fast, and the second position point reached by the first virtual object is far away from the second virtual object, it is also possible to determine whether to display the collision effect corresponding to the second virtual object through the intersection relationship between the connecting line segment and the second virtual object, thereby improving the player's user experience and the efficiency of human-computer interaction.
[0212] In an optional embodiment, when the line segment of the moving first virtual object intersects with multiple second virtual objects, the first virtual object can use the collision detection method in the above virtual environment to interact with the multiple second virtual objects. Fig.10 As shown above Figure 3 Step 340 in the illustrated embodiment may also be implemented as steps 1010 to 1030 as follows.
[0213] Step 1010: Determine a plurality of collision detection boxes respectively surrounding the plurality of second virtual objects based on position information of the plurality of second virtual objects in the virtual environment.
[0214] Illustratively, in a virtual environment, there are multiple second virtual objects to be picked up, and collision detection boxes corresponding to different second virtual objects are determined according to position information of different second virtual objects in the virtual environment.
[0215] The i-th second virtual object is surrounded by the i-th collision detection box, and i is a positive integer.
[0216] Optionally, collision detection boxes of different shapes are determined for different second virtual objects according to the shapes of props corresponding to different second virtual objects.
[0217] Step 1020 : In response to the connection line segment intersecting with at least one collision detection box among the multiple collision detection boxes, determining at least one second virtual object corresponding to the at least one collision detection box.
[0218] Illustratively, after determining a line segment connecting the first position point and the second position point, the intersection relationship between the line segment and the plurality of collision detection boxes respectively corresponding to each other is determined, thereby determining the second virtual object according to the intersection relationship.
[0219] For example, in a virtual scene, there is a collision detection box 1 corresponding to the second virtual object 1, a collision detection box 2 corresponding to the second virtual object 2, and a collision detection box 3 corresponding to the second virtual object 3, and the intersection relationship between the connecting line segment and the collision detection box 1, the collision detection box 2, and the collision detection box 3 is determined respectively. Among them, if there is an intersection point between the connecting line segment and a surface of the collision detection box 1, then there is an intersection relationship between the connecting line segment and the collision detection box 1, so as to determine the second virtual object 1 corresponding to the collision detection box 1; if there is no intersection point between the connecting line segment and the collision detection box 2, then there is no intersection relationship between the connecting line segment and the collision detection box 2; if the vertex in the connecting line segment (such as the first position point or the second position point) is located on the edge of the collision detection box 3, then there is an intersection relationship between the connecting line segment and the collision detection box 3, and the second virtual object 3 corresponding to the collision detection box 3 is determined.
[0220] That is: after judging the intersection relationship between the connecting line segment and multiple collision detection boxes, it is determined that there is an intersection relationship between the connecting line segment and collision detection box 1 and collision detection box 3, and the second virtual object 1 corresponding to collision detection box 1 and the second virtual object 3 corresponding to collision detection box 3 are determined.
[0221] Step 1030: Display a collision effect corresponding to at least one second virtual object.
[0222] In an optional embodiment, when the second virtual object is implemented as a target virtual prop, a pick-up control corresponding to at least one second virtual object is displayed, and the pick-up control is used as a pickup-allowed effect, and the pickup-allowed effect is used as the above-mentioned collision effect.
[0223] Illustratively, after determining at least one second virtual object, a pick-up control corresponding to the at least one second virtual object is displayed in a virtual screen displayed by the terminal. For example, based on the intersection relationship between the connecting line segment and the collision detection box, a second virtual object 1 corresponding to the collision detection box 1 and a second virtual object 3 corresponding to the collision detection box 3 are determined, and a pick-up control 1 corresponding to the second virtual object 1 and a pick-up control 3 corresponding to the second virtual object 3 are displayed in a virtual screen displayed by the terminal.
[0224] The pick-up control is used to pick up the second virtual object. Schematically, when the player triggers the pick-up control 1 corresponding to the second virtual object 1, the first virtual object is controlled to pick up the second virtual object 1; or, when the player triggers the pick-up control 3 corresponding to the second virtual object 3, the first virtual object is controlled to pick up the second virtual object 3.
[0225] Optionally, a virtual special effect display is performed on at least one second virtual object, and the virtual special effect display is used as a pickup permission effect.
[0226] In an optional embodiment, an object view list is displayed.
[0227] The object viewing list is used to indicate viewing of at least one second virtual object.
[0228] Optionally, in response to the second virtual object being realized as the target virtual prop, a prop pickup list is displayed, and the prop pickup list is used as the above-mentioned object viewing list.
[0229] The item pickup list is used to indicate to view at least one target virtual item.
[0230] Illustratively, after a plurality of target virtual props are determined, a prop picking list is displayed on a virtual screen displayed by the terminal, wherein the prop picking list includes at least one target virtual prop determined by the above intersection relationship.
[0231] In an optional embodiment, in response to receiving an expansion operation on the object viewing list, collision effects respectively corresponding to at least one second virtual object are displayed.
[0232] Optionally, in response to the second virtual object being implemented as a target virtual prop, in response to receiving an expansion operation on the prop pickup list, a pickup control corresponding to at least one target virtual prop is displayed.
[0233] Optionally, the prop pick-up list is triggered to implement an expansion operation on the prop pick-up list, so that pick-up controls corresponding to the at least one target virtual prop determined above are displayed on a virtual screen displayed by the terminal.
[0234] In an illustrated example, after a pickup control corresponding to any target virtual prop is triggered in the expanded prop pickup list, the virtual object is controlled to pick up the target virtual prop, so that subsequent game processes can be performed through the picked-up target virtual prop.
[0235] In summary, the first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, the first position point and the second position point are connected to obtain a connecting line segment, and when there is an intersection relationship between the connecting line segment and the second virtual object, the collision effect of the second virtual object is displayed. Even if the movement speed of the first virtual object is fast, and the second position point reached by the first virtual object is far away from the second virtual object, it is possible to determine whether to display the collision effect through the intersection relationship between the connecting line segment and the second virtual object, thereby assisting the player in controlling the first virtual object and performing a more efficient interaction process with the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction.
[0236] In an embodiment of the present application, a process of interacting with multiple second virtual objects using the collision detection method in the above virtual environment is introduced. Based on the position information of multiple second virtual objects in the virtual environment, multiple collision detection boxes that respectively surround the multiple second virtual objects are determined, and in response to the intersection relationship between the connecting line segment and at least one of the multiple collision detection boxes, at least one second virtual object corresponding to the at least one collision detection box is determined, and the collision effect corresponding to the at least one second virtual object is displayed, so as to facilitate the player to control the first virtual object and interact with the multiple second virtual objects on the connecting line segment more efficiently. For example, within a long distance from the first position point to the second position point, the first virtual object can selectively interact with the multiple second virtual objects that have an intersection relationship with the connecting line segment at the second position point, effectively improving the efficiency of human-computer interaction.
[0237] Based on the related art, the second virtual object and the first virtual object are usually regarded as points moving in the virtual scene, such as: when the second virtual object is implemented as a target virtual prop, through the prop point corresponding to the target virtual prop and the object point corresponding to the first virtual object, and according to the distance between the prop point and the object point in the virtual scene, the first virtual object is controlled to pick up the target virtual prop, such as: picking up the target virtual prop within a certain area from the first virtual object. The related art is called "point detection logic method".
[0238] In an optional embodiment, the collision detection method in the above-mentioned virtual environment is implemented through the intersection relationship between the connecting line segment and the second virtual object. The collision detection method in the above-mentioned virtual environment is called a "linear detection logic method", that is: replacing the point detection logic method, a linear detection logic method is used to pick up the target virtual props in the virtual scene.
[0239] Indicatively, Fig.11 As shown, taking the second virtual object as the target virtual object as an example, the judgment process of the collision detection method in the above virtual environment is implemented as the following steps 1110 to 1132.
[0240] Step 1110, draw a line segment with the previous frame position of the first virtual object as the starting point and the next frame position of the first virtual object as the end point, and determine the number of intersecting faces of the line segment and the three-dimensional space cube.
[0241] The three-dimensional space cube is used to indicate a collision detection box surrounding the target virtual prop.
[0242] Schematically, with the scene frame of the virtual scene change as the preset time interval, at the nth scene frame of the virtual scene, the position of the first virtual object in the virtual scene is determined, and the position is used as the starting point. Thereafter, at the n+1th scene frame of the virtual scene, the position of the first virtual object in the virtual scene is determined, and the position is used as the end point, where n is a positive integer.
[0243] Optionally, the starting point and the end point are connected to obtain a line segment. When the first virtual object does not change its moving direction during the process of moving from the starting point to the end point, the line segment is the moving track of the first virtual object.
[0244] After determining the three-dimensional space cube corresponding to the line segment and the target virtual prop, the number of intersecting faces of the line segment and the three-dimensional space cube is determined.
[0245] Step 1120, determine whether the number of intersecting faces is greater than 0.
[0246] Optionally, based on the line segment being a straight line segment, the number of intersection faces is used to indicate the number of intersection points between the line segment and six faces of the three-dimensional space cube.
[0247] In schematic form, the general formula Ax+By+Cz+D=0 is used to represent the plane equation corresponding to the three-dimensional space cube; the standard formula A(x-x0)+B(y-y0)+C(z-z0)=0 is used to represent the plane equation corresponding to the line segment. By combining the above equations, the solved expression is shown below.
[0248]
[0249] Among them, A, B, and C are used to indicate direction vectors; D is used to indicate the spatial intercept; x, y, and z are used to indicate the coordinates of any point; x0, y0, and z0 are used to indicate the coordinates of the origin; x1, y1, and z1 are used to indicate the coordinates of the end point after the first virtual object moves; x2, y2, and z2 are used to indicate the coordinates of the starting point before the first virtual object moves; and t is used to indicate the judgment parameter obtained by the solution. When t is between 0 and 1, it means that the line segment and the plane of the three-dimensional space cube have an intersection, that is, they have an intersection relationship; if t=0, it means that the line segment and the plane of the three-dimensional space cube do not have an intersection, that is, they do not have an intersection relationship.
[0250] In an optional embodiment, the position of the first virtual object in the previous frame of the virtual scene and the position of the first virtual object in the current frame of the virtual scene are determined, a line segment is drawn between the two positions, and the line segment is used to determine whether the first virtual object picks up the target virtual prop.
[0251] In schematic form, assuming that the position coordinates of the previous frame are A(5, 5, 6), and the position coordinates of the current frame are B(10, 5, 8), an interpolation (lerp) operation is performed between points AB to obtain multiple interpolation points, and it is determined whether the multiple interpolation points are located in the coordinate system of the three-dimensional prop. For example, multiple interpolation points are determined according to a preset percentage value, and it is determined whether the multiple interpolation points are located in the coordinate system of the three-dimensional prop.
[0252] Illustratively, when the number of intersections between the line segment and the three-dimensional space cube is not greater than 0, step 1131 is implemented; when the number of intersections between the line segment and the three-dimensional space cube is greater than 0, step 1132 is implemented.
[0253] Step 1131 , the target virtual prop is not within the prop picking range, or is completely within the three-dimensional space cube of the picking detection.
[0254] In schematic form, when the number of intersection faces between the line segment and the three-dimensional space cube is not greater than 0, that is, there is no intersection face number between the line segment and the three-dimensional space cube (the number of intersection faces is equal to 0), it is determined that the target virtual prop is not within the prop picking range, and thus the allowed picking effect corresponding to the target virtual prop is not displayed.
[0255] Alternatively, when the number of intersection faces of the line segment and the three-dimensional space cube is not greater than 0, it is determined that the first virtual object is completely located in the three-dimensional space cube corresponding to the first virtual object, that is, within a preset time interval, the line segment moved by the first virtual object is located in the three-dimensional space cube corresponding to the target virtual prop.
[0256] Optionally, in order to avoid the process where the target virtual prop cannot be picked up because the first virtual object is completely located within the three-dimensional space cube corresponding to the target virtual prop, when there is no intersection between the line segment and the three-dimensional space cube, the interval distance between the target virtual prop and the first virtual object in the virtual scene is determined, and when the interval distance meets the picking condition, the allowed picking effect corresponding to the target virtual prop is displayed.
[0257] Illustratively, the picking condition is: if the interval distance between the target virtual prop and the first virtual object is less than a preset interval distance, then the pickup effect corresponding to the target virtual prop is displayed.
[0258] Step 1132: The target virtual prop is within the prop pickup range.
[0259] Indicatively, when the number of intersections between the line segment and the three-dimensional space cube is greater than 0, that is, the line segment and the three-dimensional space cube have intersections, it is determined that the target virtual prop is within the prop picking range.
[0260] Optionally, in response to the target virtual prop being within the prop pickup range, the pickup effect allowed corresponding to the target virtual prop is displayed; or, in response to the target virtual prop being within the prop pickup range, the target virtual prop is automatically picked up.
[0261] Indicatively, Fig.12 , which is a schematic diagram of a virtual scene in a game application. It includes a first virtual object 1210 and a prop (smoke bomb 1220). Fig.12 The first virtual object 1210 is located at the starting point of the virtual scene schematic diagram, the first virtual object is a virtual character controlled by the player riding a mount. When the player controls the first virtual object 1210 to accelerate and move, the terminal displays the following Fig.13 As shown in the virtual scene schematic diagram, at this time, the first virtual object 1210 moves to the end position.
[0262] Alternatively, if Fig.13 As shown, in response to the intersection of the line from the starting point to the end point of the first virtual object 1210 and the smoke bomb 1220, the picking control 1230 corresponding to the smoke bomb 1220 is displayed (such as: displaying the name of the smoke bomb), and based on the player's triggering operation on the picking control 1230, the first virtual object 1210 is controlled to pick up the smoke bomb 1220, wherein the picking control 1230 is a schematic allowing picking effect.
[0263] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0264] In an optional embodiment, different bounding boxes are used to represent the second virtual object and the first virtual object, for example, when the second virtual object is implemented as a target virtual prop, the bounding box surrounding the target virtual prop is called a "prop bounding box", and the bounding box surrounding the first virtual object is called an "object bounding box". The prop picking situation is determined based on the intersection relationship between the "prop bounding box" and the "object bounding box". The above method of implementing prop picking through bounding boxes is called "bounding box detection logic", that is, instead of the point detection logic method, the bounding box detection logic method is used to pick up the target virtual prop in the virtual scene.
[0265] Indicatively, Fig.14 As shown, the judgment process of the above-mentioned prop picking method is implemented as the following steps 1410 to 1432.
[0266] Step 1410, using the AABB detection method, obtain the "object bounding box" surrounding the first virtual object and the "prop bounding box" surrounding the target virtual prop, and determine the intersection of the "object bounding box" and the "prop bounding box".
[0267] Among them, the AABB detection method uses a circumscribed rectangle parallel to the coordinate axis to analyze the collision relationship between two objects.
[0268] Schematically, the virtual scene is implemented as a 3D space. When determining the "object bounding box" that surrounds the first virtual object, a cube that can surround the first virtual object is determined in the 3D space, and the 12 sides of the cube are each parallel to the corresponding coordinate axis. For example: based on the edge of the first virtual object, a cube that can just surround the first virtual object is determined, the length of the cube is parallel to the x-axis of the 3D space, the width of the cube is parallel to the y-axis of the 3D space, and the height of the cube is parallel to the z-axis of the 3D space.
[0269] Similarly, when determining the "prop bounding box" that surrounds the target virtual prop, in 3D space, determine a cube that can surround the target virtual prop, and the 12 sides of the cube are parallel to the corresponding coordinate axes, and use the cube as the prop bounding box. For example: based on several edge points of the target virtual prop, determine a cube that can just surround the target virtual prop, the length of the cube is parallel to the x-axis of the 3D space, the width of the cube is parallel to the y-axis of the 3D space, and the height of the cube is parallel to the z-axis of the 3D space.
[0270] Optionally, as the first virtual object moves from the starting point to the end point in the virtual scene, the starting point position and the end point position of the "object bounding box" corresponding to the first virtual object in the virtual scene are determined, and when judging the intersection of the "object bounding box" and the "prop bounding box", the intersection of the "object bounding box" at the end point position and the "prop bounding box" is determined.
[0271] In an optional embodiment, the area range that the "object bounding box" corresponding to the first virtual object passes through when moving in the virtual scene is determined, and when judging the intersection of the "object bounding box" and the "prop bounding box", the intersection of the area range and the "prop bounding box" is determined.
[0272] Step 1420, determine whether the "object bounding box" and the "prop bounding box" intersect.
[0273] Optionally, the logic for determining whether there is intersection is as follows.
[0274] Take the case where the "object bounding box" and the "prop bounding box" are implemented as rectangular bounding boxes as an example. The positional relationship between the eight vertices of the "object bounding box" and the eight vertices corresponding to the "prop bounding box" is determined. When one of the eight vertices of the "object bounding box" is within the range of the "prop bounding box", it is determined that the "object bounding box" and the "prop bounding box" have an intersection relationship; similarly, when one of the eight vertices of the "prop bounding box" is within the range of the "object bounding box", it is determined that the "object bounding box" and the "prop bounding box" have an intersection relationship, etc.
[0275] Illustratively, when the “object bounding box” intersects with the “prop bounding box”, it is implemented as step 1431 ; when the “object bounding box” does not intersect with the “prop bounding box”, it is implemented as step 1432 .
[0276] Step 1431: The target virtual prop is within the prop pickup range.
[0277] Illustratively, when the “object bounding box” intersects with the “prop bounding box”, it is determined that the target virtual prop is within the prop picking range.
[0278] Optionally, in response to the target virtual prop being within the prop pickup range, the pickup effect allowed corresponding to the target virtual prop is displayed; or, in response to the target virtual prop being within the prop pickup range, the target virtual prop is automatically picked up.
[0279] Step 1432: The target virtual prop is not within the prop picking range, or is completely within the three-dimensional space cube of the picking detection.
[0280] Illustratively, when the “object bounding box” does not intersect with the “prop bounding box”, it is determined that the target virtual prop is not within the prop picking range, and thus the allowed picking effect corresponding to the target virtual prop is not displayed.
[0281] Alternatively, when the "object bounding box" and the "prop bounding box" do not intersect, it is determined that the first virtual object is completely located within the "prop bounding box" corresponding to the first virtual object, that is, within a preset time interval, the range of movement of the first virtual object is smaller than the range of the "prop bounding box" corresponding to the target virtual prop.
[0282] Optionally, in order to avoid being unable to pick up the target virtual prop due to the first virtual object being completely located in the "prop bounding box" corresponding to the target virtual prop, when the "object bounding box" and the "prop bounding box" do not intersect, the separation distance between the target virtual prop and the first virtual object in the virtual scene is determined, and when the separation distance meets the picking condition, the allowed picking effect corresponding to the target virtual prop is displayed.
[0283] Illustratively, the picking condition is: if the distance between the center point of the "prop bounding box" and the center point of the "object bounding box" is less than a preset distance, then the allowed picking effect corresponding to the target virtual prop is displayed.
[0284] It is worth noting that the above are merely illustrative examples and are not limited to the embodiments of the present application.
[0285] In summary, the starting point of the first virtual object in the virtual scene and the end point determined according to the moving speed and moving direction are obtained, and the intersection relationship between the line segment and the second virtual object is determined according to the line segment between the starting point and the end point to realize the interaction process with the second virtual object. Even if the moving speed of the first virtual object is fast and the end point position of the first virtual object is far away from the second virtual object, the interaction process with the second virtual object can be realized more efficiently through the intersection relationship between the line segment and the second virtual object. By applying the collision detection method in the virtual environment to the prop picking process, when the second virtual object is realized as a target virtual prop, a new prop picking algorithm is adopted, which solves the problem of low preparation for picking up the target virtual prop in the related technology, improves the player's gaming experience, and improves the efficiency of human-computer interaction.
[0286] Fig.15 is a structural block diagram of a collision detection device in a virtual environment provided by an exemplary embodiment of the present application, such as Fig.15 As shown, the device includes the following parts:
[0287] A position point acquisition module 1510 is used to acquire a first position point of a first virtual object in a virtual scene, where the first position point is a current position point of the first virtual object in the virtual scene;
[0288] A position point determination module 1520 is used to determine a second position point of the first virtual object in the virtual scene based on the moving speed and moving direction of the first virtual object, where the second position point is a position point reached by the first virtual object after the first position point by moving at the moving speed in the moving direction for a preset time interval;
[0289] A line segment acquisition module 1530 is configured to acquire a line segment connecting the first position point and the second position point;
[0290] The effect display module 1540 is configured to display a collision effect corresponding to the second virtual object in response to an intersection relationship between the connecting line segment and the second virtual object in the virtual scene.
[0291] In an optional embodiment, the effect display module 1540 is also used to determine a collision detection box surrounding the second virtual object based on the position information of the second virtual object in the virtual scene; in response to the intersection relationship between the connecting line segment and the collision detection box, display the collision effect corresponding to the second virtual object.
[0292] In an optional embodiment, the effect display module 1540 is further configured to display the collision effect corresponding to the second virtual object in response to an intersection between the connecting line segment and at least one surface of the collision detection box.
[0293] In an optional embodiment, the effect display module 1540 is also used to perform point sampling operations on the connecting line segment to obtain multiple line segment points in the connecting line segment; in response to the presence of at least one line segment point among the multiple line segment points being located within the collision detection box, the collision effect corresponding to the second virtual object is displayed.
[0294] In an optional embodiment, the position point determination module 1520 is also used to determine the second position point of the first virtual object in the virtual scene along the moving direction in response to the moving speed of the first virtual object reaching a preset speed threshold; or, in response to receiving a trigger operation on an acceleration control, determine the second position point of the first virtual object in the virtual scene along the moving direction.
[0295] In an optional embodiment, the line segment acquisition module 1530 is further used to acquire the connecting line segment between the first position point and the second position point in response to the distance from the first position point to the second position point meeting a preset distance threshold.
[0296] In an optional embodiment, the second virtual object includes a target virtual prop;
[0297] The effect display module 1540 is also used to display the pickup-allowed effect of the target virtual prop in response to the intersection relationship between the connecting line segment and the target virtual prop in the virtual scene, and use the pickup-allowed effect as the collision effect. The pickup-allowed effect is used to indicate the picking up of the target virtual prop.
[0298] In an optional embodiment, the second virtual object includes a target virtual character;
[0299] The display module 1540 is further configured to display an interaction effect between the first virtual object and the target virtual character in response to an intersection relationship between the connecting line segment and the target virtual character in the virtual scene, and use the interaction effect as the collision effect.
[0300] In an optional embodiment, the effect display module 1540 is also used to determine multiple collision detection boxes that respectively surround the multiple second virtual objects based on the position information of the second virtual object in the virtual environment, wherein the i-th second virtual object is surrounded by the i-th collision detection box, and i is a positive integer 1; in response to the intersection relationship between the connecting line segment and at least one collision detection box among the multiple collision detection boxes, determine at least one second virtual object corresponding to the at least one collision detection box; and display the collision effect corresponding to the at least one second virtual object.
[0301] In an optional embodiment, the effect display module 1540 is also used to display the collision effects corresponding to the at least one second virtual object; or, to display an object viewing list, wherein the object viewing list is used to indicate viewing of the at least one second virtual object; in response to receiving an expansion operation on the object viewing list, the collision effects corresponding to the at least one second virtual object are displayed.
[0302] In summary, the first position point of the first virtual object in the virtual scene and the second position point determined according to the moving speed and the moving direction are obtained, the first position point and the second position point are connected to obtain a connecting line segment, and when there is an intersection relationship between the connecting line segment and the second virtual object, the collision effect of the second virtual object is displayed. Avoid relying solely on the distance between the first virtual object and the second virtual object to display the collision effect indicating the interaction with the second virtual object. Through the above device, even if the moving speed of the first virtual object is fast and the second position point reached by the first virtual object is far away from the second virtual object, it is possible to determine whether to display the collision effect through the intersection relationship between the connecting line segment and the second virtual object, thereby assisting the player to control the first virtual object and perform a more efficient interaction process with the second virtual object passed by the connecting line segment, thereby enhancing the player's experience of the game and improving the efficiency of human-computer interaction.
[0303] It should be noted that the collision detection device in the virtual environment provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the collision detection device in the virtual environment provided in the above embodiment and the collision detection method embodiment in the virtual environment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0304] Fig.16 The block diagram of the structure of an electronic device 1600 provided by an exemplary embodiment of the present application is shown. The electronic device 1600 may be a portable mobile terminal, such as a smart phone, a vehicle-mounted terminal, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a laptop computer or a desktop computer. The electronic device 1600 may also be called a user device, a portable terminal, a laptop terminal, a desktop terminal or other names.
[0305] Typically, the electronic device 1600 includes a processor 1601 and a memory 1602 .
[0306] The processor 1601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 1601 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 1601 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1601 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0307] The memory 1602 may include one or more computer-readable storage media, which may be non-transitory. The memory 1602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1602 is used to store at least one instruction, which is used to be executed by the processor 1601 to implement the collision detection method in the virtual environment provided by the method embodiment of the present application.
[0308] In some embodiments, the electronic device 1600 further includes one or more sensors, including but not limited to: a proximity sensor, a gyroscope sensor, and a pressure sensor.
[0309] The proximity sensor, also called a distance sensor, is usually disposed on the front panel of the electronic device 1600. The proximity sensor is used to collect the distance between the user and the front of the electronic device 1600.
[0310] The gyroscope sensor can detect the body direction and rotation angle of the electronic device 1600, and the gyroscope sensor can cooperate with the acceleration sensor to collect the user's 3D actions on the electronic device 1600. The processor 1601 can implement the following functions based on the data collected by the gyroscope sensor: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0311] The pressure sensor can be set on the side frame of the electronic device 1600 and / or the lower layer of the display screen. When the pressure sensor is set on the side frame of the electronic device 1600, it can detect the user's holding signal of the electronic device 1600, and the processor 1601 performs left and right hand recognition or quick operation according to the holding signal collected by the pressure sensor. When the pressure sensor is set on the lower layer of the display screen, the processor 1601 controls the operability controls on the UI interface according to the user's pressure operation on the display screen. The operability controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0312] In some embodiments, the electronic device 1600 may further include other components, which may be understood by those skilled in the art. Fig.16 The structure shown in the figure does not constitute a limitation on the electronic device 1600, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0313] The embodiment of the present application also provides a computer device, which can be implemented as follows: Figure 2 The computer device includes a processor and a memory, wherein at least one instruction, at least one program, code set or instruction set is stored in the memory, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by the processor to implement the collision detection method in the virtual environment provided by the above-mentioned method embodiments.
[0314] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the collision detection method in a virtual environment provided by the above-mentioned method embodiments.
[0315] The embodiments of the present application also provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the collision detection method in a virtual environment described in any of the above embodiments.
[0316] Optionally, the computer readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0317] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0318] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A collision detection method in a virtual environment, characterized in that: The method comprises: Acquire a first position point of a first virtual object in a virtual scene, where the first position point is a position point of the first virtual object in an nth scene frame of the virtual scene, where n is a positive integer; In response to the moving speed of the first virtual object reaching a preset speed threshold, determining a second position point of the first virtual object in the n+1th scene frame of the virtual scene along the moving direction of the first virtual object, the second position point being a position point reached by the first virtual object after the first position point by moving in the moving direction at the moving speed for a preset time interval, the preset time interval being used to indicate a time interval between the nth scene frame and the n+1th scene frame; Obtaining a line segment between the first position point and the second position point; Determine, based on position information of the second virtual object in the virtual scene, a collision detection box surrounding the second virtual object, wherein the collision detection box is used to indicate a three-dimensional space cube surrounding the second virtual object; Performing a point sampling operation on the connecting line segment to obtain a plurality of line segment points on the connecting line segment; obtaining an interpolation point corresponding to at least one point on the connecting line segment based on a preset interpolation weight; In response to at least one of the plurality of line segment points being located in the three-dimensional space where the collision detection box is located or the interpolation point being located in the three-dimensional space where the collision detection box is located, displaying a collision effect corresponding to the second virtual object; Wherein, in the case where the second virtual object is implemented as a target virtual prop, in response to the capacity of the virtual backpack equipped by the first virtual object not reaching a preset capacity threshold, automatically picking up the target virtual prop is displayed as the collision effect; in response to the capacity of the virtual backpack equipped by the second virtual object reaching a preset capacity threshold, the allowed pickup effect corresponding to the target virtual prop is displayed as the collision effect; Wherein, when the second virtual object is implemented as a target virtual character, based on the camp to which the target virtual character belongs, an interaction effect between the first virtual object and the target virtual character is displayed as the collision effect.
2. The method according to claim 1, characterized in that In response to at least one of the plurality of line segment points being located in the three-dimensional space where the collision detection box is located or the interpolation point being located in the three-dimensional space where the collision detection box is located, displaying a collision effect corresponding to the second virtual object includes: Based on the position information of the plurality of second virtual objects in the virtual scene, determining a plurality of collision detection boxes respectively surrounding the plurality of second virtual objects, wherein the i-th second virtual object is surrounded by the i-th collision detection box, and i is a positive integer; In response to at least one of the plurality of line segment points being located in the three-dimensional space where at least one of the plurality of collision detection boxes is located or the interpolation point being located in the three-dimensional space where at least one of the plurality of collision detection boxes is located, determining at least one second virtual object corresponding to the at least one collision detection box; The collision effect corresponding to the at least one second virtual object is displayed.
3. The method according to claim 2, characterized in that The displaying the collision effect corresponding to the at least one second virtual object includes: displaying collision effects respectively corresponding to the at least one second virtual object; or, An object viewing list is displayed, where the object viewing list is used to indicate viewing of the at least one second virtual object; and in response to receiving an expansion operation on the object viewing list, collision effects respectively corresponding to the at least one second virtual object are displayed.
4. The method according to any one of claims 1 to 3, characterized in that: The obtaining of a line segment between the first position point and the second position point includes: In response to the distance between the first position point and the second position point being greater than a preset distance threshold, the connecting line segment between the first position point and the second position point is obtained.
5. A collision detection device in a virtual environment, characterized in that: The device comprises: a position point acquisition module, configured to acquire a first position point of a first virtual object in a virtual scene, the first position point being a position point of the first virtual object in an nth scene frame of the virtual scene, where n is a positive integer; in response to a movement speed of the first virtual object reaching a preset speed threshold, determining a second position point of the first virtual object in an n+1th scene frame of the virtual scene along a moving direction of the first virtual object, the second position point being a position point reached by the first virtual object after the first position point by moving in the moving direction at the moving speed for a preset time interval, the preset time interval being used to indicate a time interval between the nth scene frame and the n+1th scene frame; A line segment acquisition module, used to acquire a line segment between the first position point and the second position point; An effect display module is used to determine a collision detection box surrounding the second virtual object based on the position information of the second virtual object in the virtual scene, wherein the collision detection box is used to indicate a three-dimensional space cube surrounding the second virtual object; perform a point sampling operation on the connecting line segment to obtain a plurality of line segment points on the connecting line segment; obtain an interpolation point corresponding to at least one point on the connecting line segment based on a preset interpolation weight; in response to at least one line segment point among the plurality of line segment points being located in the three-dimensional space where the collision detection box is located or the interpolation point being located in the three-dimensional space where the collision detection box is located, display a collision effect corresponding to the second virtual object; Wherein, in the case where the second virtual object is implemented as a target virtual prop, in response to the capacity of the virtual backpack equipped by the first virtual object not reaching a preset capacity threshold, automatically picking up the target virtual prop is displayed as the collision effect; in response to the capacity of the virtual backpack equipped by the second virtual object reaching a preset capacity threshold, the allowed pickup effect corresponding to the target virtual prop is displayed as the collision effect; Wherein, when the second virtual object is implemented as a target virtual character, based on the camp to which the target virtual character belongs, an interaction effect between the first virtual object and the target virtual character is displayed as the collision effect.
6. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the collision detection method in a virtual environment as described in any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the collision detection method in a virtual environment as described in any one of claims 1 to 4.
8. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implements the collision detection method in a virtual environment as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Path finding method and device in virtual scene, equipment and storage medium
CN114377397A
Three-dimensional space data processing apparatus and program
JP2012133701A