The present application is based on and claims priority from Chinese application No. 202110407859.4, filed on Apr. 15, 2021, the disclosure of which is incorporated herein by reference in its entirety.
The present disclosure relates to the field of information technologies, and in particular, to a method and an apparatus for processing collision of virtual object, an electronic device, and a storage medium.
With the continuous development of information technology, intelligent terminals can be used not only for communication, but also for displaying multimedia information, such as video information, image information, and the like.
For example, the smart terminal may display a user interface such as a game interface, a three-dimensional (3-D) application interface, and the like. Virtual objects, such as virtual characters, virtual items, and the like, may appear in these user interfaces. Also in some scenarios the virtual objects may also be moving, resulting in possible collisions between different virtual objects.
A virtual object is currently driven to move using a skeletal animation, in which the virtual object has a skeletal structure comprising interconnected bones, and the joints between adjacent bones may be considered as nodes.
The embodiments of the present disclosure provide a method for collision processing of a virtual object, comprising:
in response to a collision occurring to the virtual object, determining a first node of the virtual object and one or more second nodes of the virtual object, the collision occurring to the first node, and each second node of the one or more second nodes being directly or indirectly connected with the first node;
The embodiments of the present disclosure further provide a collision processing apparatus for a virtual object, comprising:
The embodiments of the present disclosure further provides an electronic device, comprising:
The embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program which, when executed by a processor, implements the collision processing method of the virtual object as described above.
The embodiments of the present disclosure further provide a computer program, comprising: instructions which, when executed by a processor, implement the collision processing method of the virtual object as described above.
The embodiments of the present disclosure also provide a computer program product comprising a computer program or instructions which, when executed by a processor, implement the collision processing method of the virtual object as described above.
The above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent by referring to the following detailed embodiments when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference signs refer to the same or similar elements. It should be understood that the drawings are schematic and that the elements and components are not necessarily drawn to scale.
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more complete and thorough understanding of the present disclosure. It should be understood that the drawings and the embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the embodiments of the method of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term “comprise” and variations thereof as used herein are intended to be open-ended, i.e., “comprising but not limited to”. The term “based on” means “based at least in part on”. The term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; the term “some embodiments” means “at least some embodiments”. Relevant definitions for other terms will be given in the following description.
It should be noted that the terms “first”, “second”, and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence of the functions performed by the devices, modules or units.
It is noted that the modifiers like “one” or “more” in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will appreciate that they refer to “one or more” unless the context clearly indicates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
After a collision occurs to a virtual object, a change of a position of a node cannot be displayed more realistically, which reduces sense of reality of the pictures. In order to solve the above technical problem or at least partially solve the above technical problem, embodiments of the present disclosure provide a method and an apparatus for processing collision of a virtual object, an electronic device and a storage medium, which, when collision occurs at a joint point of the virtual object, not only cause a change in position of the collided joint point, but also cause a change in position of other joint points directly or indirectly connected to the joint. Therefore, the position change of each joint point when collision occurs can be displayed more realistically, and the sense of reality of pictures is improved.
As shown in
In S101, in response to a collision occurring to a virtual object, a first node of the virtual object and one or more second nodes of the virtual object are determined, wherein the collision occurs to the first node, and each second node of the one or more second nodes is directly or indirectly connected with the first node.
As shown in
As shown in
Optionally, each node in the tree structure corresponding to the virtual object corresponds to a first bounding sphere respectively; and it is determined a collision occurs to the virtual object in response to the first bounding sphere colliding with a second bounding sphere of another physical entity in the virtual scene.
Mold penetration refers to mutual penetration or superposition between virtual objects or characters due to a mistake in setting a collision volume and the like. In order to ensure that the limb joints do not penetrate the other physical entities in the virtual scene during the simulated motion, a bounding box or bounding sphere with a simple shape is used in the present embodiment to enclose the entity which may cross the model. As shown in
When collision occurs to the virtual character, a first node of the virtual character at which the collision occurs may be further determined, for example, in response to the first bounding sphere 461 colliding with the second bounding sphere 462 of another physical entity, it may be determined that the collision occurs to the node 46, and node 46 may be marked as the first node. Further, one or more nodes of the virtual character that are directly or indirectly connected to node 46 may be determined from node 46. For example, node 44 and node 48 are nodes directly connected to node 46, and node 40 and the right palm are nodes indirectly connected to node 46. Here, node 40, node 44, node 48, and the right palm may be respectively referred to as second nodes.
In S102, a first target position of the first node is determined according to a force applied to the first node during the collision.
For example, in response to a collision occurring at node 46, a first target position of node 46, which may be an ideal position of node 46 after the collision, may be determined based on the force applied to node 46 during the collision.
Optionally, the force applied to the first node in the collision process is a force applied to the first bounding sphere corresponding to the first node in the collision process.
The physical collision effect of the bounding sphere can be taken as the collision effect of the node in this embodiment. The physical collision may simulate newton's third law, for example, in the case that the first bounding sphere 461 collides with the second bounding sphere 462 of another physical entity, the first bounding sphere 461 and the second bounding sphere 462 may give each other a force with equal magnitude and opposition directions, which acts on the same straight line, at the position where the collision occurs. This force is the force applied to first and second bounding spheres 461 and 462, respectively, during the collision, and likewise, it's also the force applied to node 46 during the collision. Further, the ideal position of node 46 after the collision, i.e., the first target position, is determined based on the force applied to node 46 during the collision.
It will be appreciated that in other embodiments, the force applied to the node where collision occurs may be calculated directly from newton's third law, without the aid of a bounding sphere.
In S103, a second target position of the first node and a second target position of the each second node are determined according to the first target position.
Since node 40, node 44, node 48, and the right palm are each directly or indirectly connected to node 46, in response to a collision occurring at node 46, a position or an angle of node 46 may change, which in turn causes changes in positions or angles of node 40, node 44, node 48, and the right palm.
For example, a second target position of node 46 and second target positions of node 40, node 44, node 48 and the right palm are determined based on the first target position, respectively. The second target position of node 46 may be an actual position of node 46 after the collision occurs at node 46, and the second target positions of node 40, node 44, node 48, and the right palm, respectively, may be actual positions corresponding to node 40, node 44, node 48, and the right palm, respectively, after the collision occurs at node 46.
In S104, a posture of the virtual object in a user interface is adjusted according to the second target position of the first node and the second target position of the each second node.
Further, a posture of the virtual character in the user interface may be adjusted based on the second target position of node 46 and the second target positions of node 40, node 44, node 48, and the right palm, respectively. For example, a right arm of the virtual character may bend.
In the collision processing method of virtual object provided by the embodiment of the disclosure, when the collision occurs to the virtual object, the first node in the virtual object, where the collision occurred, and the one or more second nodes which are directly or indirectly connected with the first node, are determined. Further, the first target position of the first node is determined according to the force applied on the first node during the collision, and a second target position of the first node and a second target position of the each second node are determined according to the first target position. Thereby the posture of the virtual object in the user interface is adjusted based on the second target position of the first node and the second target position of the each second node. In response to a collision occurring to a joint point of the virtual object, not only the joint point where the collision occurs is changed in position, but also other joint points directly or indirectly connected to the joint point are caused to change in position. Therefore, the position change of each joint point when collision occurs can be displayed more realistically, and the sense of reality of pictures is improved.
On the basis of the foregoing embodiment, the determining the second target position of the first node and the second target position of the each second node according to the first target position comprises: determining the second target position of the first node and the second target position of the each second node according to the first target position and a first original position of a first reference node in the one or more second nodes before the collision occurs, wherein the second target position of the first reference node is the first original position.
As shown in
For example, in response to a collision occurring at node A, node A may act as the first node. Further, a first target position of node A may be determined according to a force applied to node A during the collision, wherein the first target position may be a position of point F shown in
Taking N=4 as an example, a position of a first reference node, i.e., node E, before the collision occurs is denoted as a first original position. Specifically, second target positions, that is, actual positions after the collision, corresponding to node A, node B, node C, node D, and node E may be calculated according to the position of point F, i.e., the first target position of the node A and the first original position of the node E before the collision occurs. The second target position of node E is still the first origin position, since the position of the first reference node before and after the collision remains unchanged. In addition, in the present embodiment, the position of point F and the first original position of node E before the collision occurs may be fixed.
Optionally, the second target position of the first node and the second target position of the each second node are determined according to the first target position and the first original position of the first reference node in the one or more second nodes before the collision occurs, which comprises steps S601 to S603 shown in
In S601, a first iteration is performed in a direction from the first node towards the first reference node to obtain a first updated position of the first reference node, wherein during the first iteration, the first node moves to the first target position, and a child node in a path from the first node to the first reference node affects at least one of a displacement or a rotation of a parent node.
As shown in
Further, a connection line between node B and node C needs to be moved so that node B moves to B1. Specifically, B1 is used as a target end point of the connection line between node B and node C, and B1 is connected to a start point of the connection line, i.e., node C, as shown in (2) of
Further, a connection line between node C and node D is moved so that node C moves to C1. Specifically, C1 is used as a target end point of the connection line between node C and node D, and C1 is connected with a start point of the connection line, i.e., node D, as specifically shown in (3) of
Further, a connection line between node D and node E is moved so that node D moves to D1. Specifically, D1 is used as a target end point of the connection line between node D and node E, and D1 is connected with a starting point of the connection line, i.e., node E, as shown in (4) in
E1 may be marked as a first updated position of a first reference node, i.e., node E, and in an iterative process as shown in
Furthermore, the iterative process shown in
In S602, a second iteration is performed in a direction from the first reference node towards the first node, wherein during the second iteration, the first reference node moves from the first updated position to the first original position, and a parent node in a path from the first reference node to the first node affects at least one of a displacement or a rotation of a child node.
Since node E is used as the first reference node, its position before and after the collision is unchanged, but after the iteration shown in
As shown in
Further, the connection line between node C and node D needs to be moved so that the node D moves to D1. Specifically, D1 is used as a target starting point of the connection line between node C and node D, and D1 is connected to an end point of the connection line, i.e., node C, to obtain a connection line between D1 and node C, which is specifically shown as (2) in
Further, the connection line between node B and node C is moved so that C moves to C1. Specifically, C1 is used as a target starting point of a connection line between node B and node C, and C1 is connected to the end point of the connection line, i.e., node B, to obtain a connection line between C1 and node B, which is specifically shown as (3) in
Further, the connection line between node A and node B is moved so that B moves to B1. Specifically, B1 is taken as a target starting point of the connection line between node A and node B, and B1 is connected to an end point of the connection line, i.e., node A, to obtain a connection line between B1 and node A, which is specifically shown as (4) in
As can be seen from
In S603, the second target position of the first node and the second target position of the each second node are determined according to a second updated position of the first node obtained by the second iteration.
As shown in
In one possible implementation: the first node is a leaf node in the tree structure corresponding to the virtual object.
As shown in
Optionally, determining the second target position of the first node and the second target position of the each second node according to the second updated position of the first node obtained by the second iteration comprises: continuing to perform the first iteration and the second iteration according to the second updated position of the first node obtained by the second iteration to obtain the second target position of the first node and the second target position of the each second node in response to iteration times of the first iteration and the second iteration meeting a preset condition.
For example, in a case that node A where the collision occurs is a leaf node in the tree structure corresponding to the virtual object, the first iteration as shown in
In another possible implementation: the first node is a non-leaf node in a tree structure corresponding to the virtual object. As shown in
Optionally, the second target position of the first node and the second target position of the each second node are determined according to the second updated position of the first node obtained by the second iteration, which comprises the following steps S1001 to S1004 shown in
In S1001, a third iteration is performed in a direction from the first node towards a second reference node of the one or more second nodes to obtain a third updated position of the second reference node, wherein during the third iteration, the first node is located at the second updated position, and a parent node in a path from the first node to the second reference node affects at least one of a displacement or a rotation of a child node.
As shown in
In S1002, a fourth updating position of the second reference node is determined according to the third updating position of the second reference node and a second original position of the second reference node before the collision occurs.
As shown in (4) of
Optionally, determining a fourth updated position of the second reference node according to the third updated position of the second reference node and a second original position of the second reference node before the collision occurs comprises: determining a connection line between the third updated position and the second original position of the second reference node before the collision occurs according to the third updated position of the second reference node and the second original position of the second reference node before the collision occurs; and selecting a point from the connection line as a fourth updated position of the second reference node.
As shown in (5) of
In S1003, a fourth iteration is performed in a direction from the second reference node towards the first node, wherein during the fourth iteration, the second reference node moves from the third updated position to the fourth updated position, and a child node in a path from the second reference node to the first node affects at least one of a displacement or a rotation of a parent node.
Further, a fourth iteration is performed in a direction from node A to node C, and as for the fourth iteration, please refer to the first iteration shown in
In S1004, the second target position of the first node and the second target position of the each second node are determined according to a fifth updated position of the first node obtained by the fourth iteration.
As shown in (7) of
Optionally, determining the second target position of the first node and the second target position of the each second node according to the fifth updated position of the first node obtained by the fourth iteration comprises: continuing to perform the first iteration, the second iteration, the third iteration and the fourth iteration according to the fifth updated position of the first node obtained by the fourth iteration, and obtaining the second target position of the first node and the second target position of the each second node in response to the iteration times of the first iteration, the second iteration, the third iteration and the fourth iteration meeting a preset condition.
For example, the first iteration from node C to node E, the second iteration from node E to node C, the third iteration from node C to node A, and the fourth iteration from node A to node C continue according to C2 in (7) as shown in
It will be appreciated that every time a complete iteration is performed, the positions of the nodes participating in the iteration may change once. For example, as shown in
According to the collision processing method of a virtual object provided in the embodiment of the present disclosure, in response to the first node where the collision occurs being a leaf node, the position of the first node after iteration gradually approaches to the first target position determined according to the force applied to the first node in the collision process through iteration from the first node to the first reference node for multiple times and iteration from the first reference node to the first node for multiple times. In addition, in response to the first node where the collision occurs being a non-leaf node, the first node where the collision occurs can drive the leaf node and other nodes between the first node and the leaf node to change positions by iterating from the first node to the first reference node for multiple times, iterating from the first reference node to the first node for multiple times, iterating from the first node to the second reference node for multiple times, and iterating from the second reference node to the first node for multiple times. Furthermore, the more the number of iterations, the more accurate the actual position of the first node after the collision is, and the more natural the actual position of the second node directly or indirectly connected to the first node after the collision is, which makes the picture more real.
Optionally, the third determining module 113 is specifically configured to:
Optionally, the third determining module 113 comprise: an iteration unit 1131 and a determination unit 1132; wherein the iteration unit 1131 is configured to: perform a first iteration in a direction from the first node towards the first reference node to obtain a first updated position of the first reference node, wherein during the first iteration, the first node moves to the first target position, and a child node in a path from the first node to the first reference node affects at least one of a displacement or a rotation of a parent node; perform a second iteration in a direction from the first reference node towards the first node, wherein during the second iteration, the first reference node moves from the first updated position to the first original position, and a parent node in a path from the first reference node to the first node affects at least one of a displacement or a rotation of a child node; and the determination unit 1132 is configured to determine the second target position of the first node and the second target position of the each second node according to a second updated position of the first node obtained by the second iteration.
Optionally, the iteration unit 1131 is specifically configured to: continue to perform the first iteration and the second iteration according to the second updated position of the first node obtained by the second iteration to obtain the second target position of the first node and the second target position of the each second node in response to iteration times of the first iteration and the second iteration meeting a preset condition.
Optionally, the first node is a leaf node in a tree structure corresponding to the virtual object.
Optionally, the iteration unit 1131 is further configured to: perform a third iteration in a direction from the first node towards a second reference node of the one or more second nodes to obtain a third updated position of the second reference node, wherein during the third iteration, the first node is located at the second updated position, and a parent node in a path from the first node to the second reference node affects at least one of a displacement or a rotation of a child node; the determining unit 1132 is further configured to: determine a fourth updating position of the second reference node according to the third updating position of the second reference node and a second original position of the second reference node before the collision occurs; the iteration unit 1131 is further configured to: perform a fourth iteration in a direction from the second reference node towards the first node, wherein during the fourth iteration, the second reference node moves from the third updated position to the fourth updated position, and a child node in a path from the second reference node to the first node affects at least one of a displacement or a rotation of a parent node; the determining unit 1132 is further configured to: determine the second target position of the first node and the second target position of the each second node according to a fifth updated position of the first node obtained by the fourth iteration.
Optionally, the determining unit 1132 is specifically configured to: continue to perform the first iteration, the second iteration, the third iteration and the fourth iteration according to the fifth updated position of the first node obtained by the fourth iteration; and obtain the second target position of the first node and the second target position of the each second node in response to the iteration times of the first iteration, the second iteration, the third iteration and the fourth iteration meeting a preset condition.
Optionally, the first node is a non-leaf node in a tree structure corresponding to the virtual object.
Optionally, the determining unit 1132 is specifically configured to: determine a connection line between the third updated position and the second original position of the second reference node according to the third updated position of the second reference node and the second original position of the second reference node before the collision occurs; and select a point from the connection line as the fourth updated position of the second reference node.
Optionally, the child node and the parent node are determined according to a tree structure corresponding to the virtual object.
Optionally, each node in a tree structure corresponding to the virtual object corresponds to a first bounding sphere. It is determined that the collision occurs to the virtual object in response to the first bounding sphere colliding with a second bounding sphere of another physical entity in a virtual scene.
Optionally, the force applied to the first node during the collision is a force applied to the first bounding ball corresponding to the first node during the collision.
The apparatus for processing collision of a virtual object provided in the embodiment of the present disclosure may execute the steps executed by a client or a server in the method for processing collision of a virtual object provided in the embodiment of the present disclosure, and the steps and the beneficial effects are not described herein again.
As shown in
Generally, the following means may be connected to the I/O interface 1205: input means 1206 comprising, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, or the like; output means 1207 comprising, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; memory device 1208 comprise, for example, magnetic tape, hard disk, etc.; and a communication means 1209. The communication means 1209 may allow the electronic device 1200 to communicate in a wireless or wired manner with other means to exchange data. While
In particular, the process described above with reference to the flow chart may be implemented as a computer software program, according to the embodiments of the present disclosure. For example, the embodiments of the present disclosure comprise a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart, thereby implementing the collision processing method of a virtual object as described above. In such embodiments, the computer program may be downloaded and installed from a network through the communication means 1209, or installed from the memory device 1208 or the ROM 1202. The computer program, when executed by the processing means 1201, performs the above-described functions defined in the method of the embodiments of the present disclosure.
It should be noted that the computer readable medium of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may comprise, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, the computer readable signal medium may include a propagated data signal with computer readable program code carried therein in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, an electro-magnetic signal, an optical signal, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program codes included in a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
In some embodiments, the clients and servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (“LAN”), a wide area network (“WAN”), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may be separate and not incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
Optionally, when the one or more programs are executed by the electronic device, the electronic device may also perform other steps described in the above embodiments.
The computer program codes for performing the operations of the present disclosure may be written in one or more programming languages or combination thereof, including but not limited to an object oriented programming language such as Java, Smalltalk, C++, including conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program codes may be executed entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on a remote computer or server. In the situation involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flow charts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow charts or block diagrams may represent a module, a program segment, or a part of codes, which comprises one or more executable instructions for implementing the specified logical function(s) It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur in an order different from that marked in the accompanying drawings. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The name of an element does not constitute a limitation on the element itself in some cases.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic apparatuses (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination thereof. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
According to one or more embodiments of the present disclosure, there is provided a collision processing method for a virtual object, comprising:
According to one or more embodiments of the present disclosure, in the collision processing method of a virtual object provided by the present disclosure, the determining the second target position of the first node and the second target position of the each second node according to the first target position comprises:
According to one or more embodiments of the present disclosure, in a collision processing method of a virtual object provided by the present disclosure, the determining the second target position of the first node and the second target position of the each second node according to the first target position and the first original position of the first reference node in the one or more second nodes before the collision occurs comprises:
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, the determining the second target position of the first node and the second target position of the each second node according to the second updated position of the first node obtained by the second iteration comprises:
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, the first node is a leaf node in a tree structure, the tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, the determining the second target position of the first node and the second target position of the each second node according to the second updated position of the first node obtained by the second iteration comprises:
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, the determining the second target position of the first node and the second target position of the each second node according to the second updated position of the first node obtained by the second iteration comprises:
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, the first node is a non-leaf node in a tree structure, the tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in a collision processing method of a virtual object provided by the present disclosure, the determining the fourth updating position of the second reference node according to the third updating position of the second reference node and the second original position of the second reference node before the collision occurs comprises:
According to one or more embodiments of the present disclosure, in the collision processing method of the virtual object provided by the present disclosure, the child node and the parent node are determined according to a tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in the collision processing method for a virtual object provided by the present disclosure, each node in a tree structure corresponding to the virtual object corresponds to a first bounding sphere;
According to one or more embodiments of the present disclosure, in the collision processing method of a virtual object provided by the present disclosure, the force applied to the first node during the collision is a force applied to the first bounding ball corresponding to the first node during the collision.
According to one or more embodiments of the present disclosure, there is provided a collision processing apparatus of a virtual object, comprising:
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the third determining module is specifically configured to:
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the third determining module comprise: an iteration unit and a determination unit; wherein the iteration unit is configured to: perform a first iteration in a direction from the first node towards the first reference node to obtain a first updated position of the first reference node, wherein during the first iteration, the first node moves to the first target position, and a child node in a path from the first node to the first reference node affects at least one of a displacement or a rotation of a parent node; perform a second iteration in a direction from the first reference node towards the first node, wherein during the second iteration, the first reference node moves from the first updated position to the first original position, and a parent node in a path from the first reference node to the first node affects at least one of a displacement or a rotation of a child node; and the determination unit is configured to determine the second target position of the first node and the second target position of the each second node according to a second updated position of the first node obtained by the second iteration.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the iteration unit is specifically configured to: continue to perform the first iteration and the second iteration according to the second updated position of the first node obtained by the second iteration to obtain the second target position of the first node and the second target position of the each second node in response to iteration times of the first iteration and the second iteration meeting a preset condition.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the first node is a leaf node in a tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the iteration unit is further configured to: perform a third iteration in a direction from the first node towards a second reference node of the one or more second nodes to obtain a third updated position of the second reference node, wherein during the third iteration, the first node is located at the second updated position, and a parent node in a path from the first node to the second reference node affects at least one of a displacement or a rotation of a child node; the determining unit is further configured to: determine a fourth updating position of the second reference node according to the third updating position of the second reference node and a second original position of the second reference node before the collision occurs; the iteration unit is further configured to: perform a fourth iteration in a direction from the second reference node towards the first node, wherein during the fourth iteration, the second reference node moves from the third updated position to the fourth updated position, and a child node in a path from the second reference node to the first node affects at least one of a displacement or a rotation of a parent node; the determining unit is further configured to: determine the second target position of the first node and the second target position of the each second node according to a fifth updated position of the first node obtained by the fourth iteration.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the determining unit is specifically configured to: continue to perform the first iteration, the second iteration, the third iteration and the fourth iteration according to the fifth updated position of the first node obtained by the fourth iteration; and obtain the second target position of the first node and the second target position of the each second node in response to the iteration times of the first iteration, the second iteration, the third iteration and the fourth iteration meeting a preset condition.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the first node is a non-leaf node in a tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, determining unit is specifically configured to: determine a connection line between the third updated position and the second original position of the second reference node according to the third updated position of the second reference node and the second original position of the second reference node before the collision occurs; and select a point from the connection line as the fourth updated position of the second reference node.
According to one or more embodiments of the present disclosure, in a collision processing apparatus of a virtual object provided by the present disclosure, the child node and the parent node are determined according to a tree structure corresponding to the virtual object.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, each node in a tree structure corresponding to the virtual object corresponds to a first bounding sphere. It is determined that the collision occurs to the virtual object in response to the first bounding sphere colliding with a second bounding sphere of another physical entity in a virtual scene.
According to one or more embodiments of the present disclosure, in the collision processing apparatus of a virtual object provided by the present disclosure, the force applied to the first node during the collision is a force applied to the first bounding ball corresponding to the first node during the collision.
According to one or more embodiments of the present disclosure, there is provided an electronic device comprising: one or more processors;
According to one or more embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the collision processing method of a virtual object provided in any of the embodiments of the present disclosure.
The embodiments of the present disclosure further provide a computer program, comprising: instructions which, when executed by a processor, implement the collision processing method of a virtual object as described above.
The embodiments of the present disclosure also provide a computer program product comprising a computer program or instructions which, when executed by a processor, implement the collision processing method of a virtual object as described above.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other technical solutions formed by any combination of the technical features described above or equivalents thereof without departing from the spirit of the disclosure, such as technical solutions formed by mutual replacement of the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub combination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claim.
Number | Date | Country | Kind |
---|---|---|---|
202110407859.4 | Apr 2021 | CN | national |
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2022/081961 | 3/21/2022 | WO |