WO2018192394A1 - Interaction method and apparatus for virtual reality scene, storage medium and electronic apparatus - Google Patents

Interaction method and apparatus for virtual reality scene, storage medium and electronic apparatus Download PDF

Info

Publication number
WO2018192394A1
WO2018192394A1 PCT/CN2018/082512 CN2018082512W WO2018192394A1 WO 2018192394 A1 WO2018192394 A1 WO 2018192394A1 CN 2018082512 W CN2018082512 W CN 2018082512W WO 2018192394 A1 WO2018192394 A1 WO 2018192394A1
Authority
WO
WIPO (PCT)
Prior art keywords
ray
target object
virtual reality
reality scene
final target
Prior art date
Application number
PCT/CN2018/082512
Other languages
French (fr)
Chinese (zh)
Inventor
沈超
Original Assignee
腾讯科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Publication of WO2018192394A1 publication Critical patent/WO2018192394A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2203/00Indexing scheme relating to G06F3/00 - G06F3/048
    • G06F2203/01Indexing scheme relating to G06F3/01
    • G06F2203/012Walk-in-place systems for allowing a user to walk in a virtual environment while constraining him to a given position in the physical environment

Definitions

  • the present application relates to the field of computers, and in particular, to a method and device for interacting with a virtual reality scene, a storage medium, and an electronic device.
  • VR Virtual Reality
  • mouse interaction As Currently, interaction methods commonly used in related technologies include: mouse interaction. Among them, the mouse interaction for any program selection includes:
  • the displayed object has a corresponding position on the two-dimensional (2D) screen, and the interaction process with the object can be realized by clicking the position of the object on the 2D screen by the mouse.
  • the mouse interaction mode provided in the related art is mainly applied to interact with an object displayed in a two-dimensional plane space, and a three-dimensional object in a virtual reality VR scene does not provide a simplified interaction mode.
  • the embodiments of the present application provide a method and device for interacting with a virtual reality scenario, a storage medium, and an electronic device, so as to at least solve the technical problem that the related art cannot perform interaction with an object in a virtual reality scenario.
  • an interaction method of a virtual reality scene including: determining, in an object displayed in a virtual reality scene, an initial target object that is allowed to collide with a ray, wherein the virtual reality scene is The ray is displayed; a final target object colliding with the ray is detected in the initial target object; and the control selected by the ray in the final target object is operated.
  • an interaction device for a virtual reality scene comprising: a determining unit configured to determine, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, Wherein the ray is displayed in the virtual reality scene; the detecting unit is configured to detect a final target object colliding with the ray in the initial target object; and the operating unit is configured to select the ray in the final target object
  • a determining unit configured to determine, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, Wherein the ray is displayed in the virtual reality scene
  • the detecting unit is configured to detect a final target object colliding with the ray in the initial target object
  • the operating unit is configured to select the ray in the final target object The controls operate.
  • an electronic device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein the processor is executed by the computer program
  • a storage medium having stored therein a computer program, wherein the computer program is configured to execute the steps of any one of the method embodiments described above.
  • the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
  • FIG. 1 is a schematic diagram of a hardware environment of an interaction method of a virtual reality scenario according to an embodiment of the present application
  • FIG. 2 is a flowchart of an optional interaction method of a virtual reality scene according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an optional interaction method of a virtual reality scene according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another optional interaction method of a virtual reality scene according to an embodiment of the present application.
  • FIG. 5 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application.
  • FIG. 6 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application.
  • FIG. 7 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application.
  • FIG. 8 is a schematic diagram of an optional virtual reality scene interaction apparatus according to an embodiment of the present application.
  • FIG. 9 is a structural block diagram of an interaction terminal of a virtual reality scenario according to an embodiment of the present application.
  • an embodiment of an interaction method of the above virtual reality scenario is provided.
  • the interaction method of the virtual reality scenario may be, but is not limited to, applied to the device 102 for implementing virtual reality (VR) scenario interaction in the application environment as shown in FIG. Displaying an object to be interacted, and determining an initial target object that allows collision with the ray in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene; and the final collision with the ray is detected in the initial target object The target object; then the controls in the ray selection in the final target object are manipulated.
  • VR virtual reality
  • the initial target object that allows collision with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and the ray occurrence is detected in the initial target object.
  • the final target object of the collision which operates on the controls selected by the ray in the final target object.
  • the foregoing apparatus for implementing virtual reality scene interaction may include, but is not limited to, at least one of the following: VR glasses, and other hardware devices for implementing virtual reality scene interaction.
  • VR glasses and other hardware devices for implementing virtual reality scene interaction.
  • the above is only an example, and the embodiment does not limit this.
  • a method for interacting a virtual reality scenario includes:
  • the interaction method of the virtual reality scenario may be, but is not limited to, being applied to a virtual reality interactive application using a virtual reality device.
  • the virtual reality interaction application may include but is not limited to virtual reality. Games, virtual reality video playback, virtual reality shopping, and more.
  • the above is only an example, and is not limited in this embodiment.
  • the virtual reality device may include, but is not limited to, VR glasses.
  • the above interaction process may be, but is not limited to, interacting with objects in a plane in a virtual reality scene, for example, as shown in FIG. 3, which is shown in the dotted line box as VR glasses (device 102 for virtual reality scene interaction).
  • the displayed virtual reality scene content the object A to the object E to be interacted in the two-dimensional plane, wherein the final target object colliding with the ray is the object E; further, in the embodiment, the interaction process may be It is not limited to interacting with a three-dimensional character object in a virtual reality scene.
  • the virtual reality scene content displayed in the VR glasses is shown in the dotted line box:
  • the object P to be interacted, the object X, the object Y, and the object Z are displayed in the three-dimensional space, wherein the final target object colliding with the ray is the object Y.
  • the above is only an example, and is not limited in this embodiment.
  • the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
  • the above collision detection (also referred to as collision detection) generally refers to a method of determining whether two or more objects generate an intersection. It can be applied to video games and other computational physics, as well as to artificial intelligence. In addition to being used to determine if two objects have collided, it can also be used to calculate the time of impact (TOI) and to obtain the location of the object's cross collision.
  • TOI time of impact
  • determining, in the object displayed in the virtual reality scene, the initial target object that is allowed to collide with the ray comprises: determining, according to the object type of the object, a target object having a corresponding relationship with the ray type of the ray Type to determine the object of the target object type as the initial target object that is allowed to collide with the ray.
  • the mapping relationship between the ray type and the object type is used to determine the initial target object that is allowed to collide with the ray, so as to avoid the ray-independent object participating in the interactive judgment process in the virtual reality scene, reducing the judgment time, thereby achieving simplified interaction. Determine the effect of the step.
  • detecting the final target object that collides with the ray in the initial target object includes: traversing each initial target object, and detecting whether the space occupied by each initial target object in the virtual reality scene is There is a portion that coincides with the ray; an initial target object having a portion that coincides with the ray is determined as the final target object.
  • the ray may be, but is not limited to, a vector having a start point and an end point.
  • the foregoing detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may but not It is limited to: detecting whether or not the point in the vector formed by the above-mentioned rays is included in the space. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray.
  • the collision detection may be performed for each frame to determine whether the space occupied by the virtual reality scene includes the above-mentioned rays. Points in the vector to ensure the accuracy of collision detection.
  • the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like.
  • the execution event corresponding to the above operation may include, but is not limited to, at least one of the following:
  • Enter event The ray starts to point to an object, and compares the change of the hit object list of the ray of the previous frame and the previous frame to see if there is a newly added object, triggering the event of the newly added object;
  • controls may be, but are not limited to, a series of pre-made functional controls for constructing an interface, such as buttons, check boxes, sliders, progress bars, and the like.
  • a series of pre-made functional controls for constructing an interface such as buttons, check boxes, sliders, progress bars, and the like.
  • the above is only an example, and is not limited in this embodiment.
  • the ray is displayed in the virtual reality scene, and then detected in the initial target object.
  • the final target object in which the ray collides, operating on the ray-selected controls in the final target object.
  • the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology.
  • determining an initial target object that is allowed to collide with the ray in the object displayed in the virtual reality scene includes:
  • the type of the object that allows collision with the ray is set as the target object type, represented by the object collision object, and the type of the ray for collision detection is represented by a laser collision object.
  • the target object type represented by the object collision object
  • the type of the ray for collision detection is represented by a laser collision object.
  • the collision mode for performing the ray collision detection may be, but not limited to, using the collision bounding box in the related art, and detecting the collision surrounding by surrounding the detected individual with the collision bounding box. Whether the box has an intersection, and in the case of an intersection, it is detected as a collision.
  • the manner of collision detection is not limited, and other collision detection methods may also be adopted.
  • collision detection is performed on the target object type corresponding to the ray type, thereby directly skipping the object that is not the target object type.
  • the detection reaches the number of objects that reduce the collision detection by the ray, and the effect of greatly reducing the time consumption of the collision detection is realized, thereby achieving the effect of simplifying the interactive judgment step.
  • detecting the final target object that collides with the ray in the initial target object includes:
  • the current target object is determined as the final target object.
  • the traversal determination process may be performed on the initial target object determined to be the target object type, where each initial target object is respectively used as the current target object: detecting the current target object in the virtual reality Whether the space occupied by the scene has a portion coincident with the ray; the initial target object of the portion where the ray coincides is determined as the final target object.
  • the ray may be, but is not limited to, a vector having a starting point and an ending point.
  • the detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may be, but is not limited to, detecting whether the space includes a point in the vector formed by the ray. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray.
  • the space occupied by the current target object in the virtual reality scene may be, but is not limited to, as shown in FIG. 3 .
  • the space occupied by the object E in the virtual reality scene is a rectangular plane area; As shown in FIG. 4, taking the object Y as an example, the space occupied by the object Y in the virtual reality scene is a three-dimensional space occupied by the character character Y in the three-dimensional space.
  • the following example is used. For example, taking the object E shown in FIG. 3 as an example, if it is detected that there is a cross between the rectangular plane regions corresponding to the object E, it is possible to detect that the object E has a portion overlapping with the ray, and the object can be detected. E is determined as the final target object. For example, taking the object Y shown in FIG. 4 as an example, if it is detected that the three-dimensional space occupied by the persona Y corresponding to the object Y intersects, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be detected. Determined as the final target object.
  • each initial target object by traversing each initial target object, it is sequentially determined whether the space occupied by each initial target object in the virtual reality scene has a portion overlapping with the ray, so as to accurately detect the interaction for the interaction according to the determination result.
  • the ultimate target object ensures the accuracy of the interaction.
  • detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray includes:
  • S1 detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
  • the ray may be, but is not limited to, a directional vector including a starting point and an ending point.
  • the starting point may be, but not limited to, a position where a ray is emitted in a virtual reality scene, and an end point is a position that arrives after extending a certain distance according to a direction indicated by the ray, and collision detection is required at each position on the ray.
  • the starting point takes the position of the finger in the virtual reality scene (as indicated by Hand Position) as an example, according to the extended distance of the ray set in advance (as indicated by Max Distance), the corresponding point is obtained.
  • the end point (as indicated by the Max Range Position) detects whether the space occupied by the object Y includes the point on the above-mentioned ray according to the direction of the finger.
  • the collision detection result indicates that the stereoscopic space occupied by the persona Y corresponding to the object Y intersects with the ray (the starting point is the Hand Position and the end point is the Max Range Position), and the intersection point is as shown in FIG. 6 .
  • the position is displayed, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be determined as the final target object.
  • the end point is determined by determining the end point in the virtual reality scene according to the position of the starting point in the virtual reality scene, the direction vector for indicating the direction, and the predetermined determined distance range value. s position.
  • the above Hand Forward Vector is used to represent a unit vector of a ray direction. That is to say, on the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the extending distance in the ray direction are superimposed, thereby obtaining the three-dimensional coordinates of the end point.
  • the present application by detecting whether the space includes a point on the ray, it is possible to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray, that is, in the virtual reality scene.
  • the space occupied and the position of each point on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray, thereby ensuring the accuracy of the collision detection, thereby achieving the effect of improving the interaction accuracy.
  • operating the controls selected in the ray selection in the final target object includes:
  • the operation of the control includes:
  • the objects in the virtual reality scene may include, but are not limited to, an object designed by an Unreal Mobile UI designer (referred to as a UMG object), and an object in the target object type.
  • UMG object an object designed by an Unreal Mobile UI designer
  • the UMG-related control logic needs to be called.
  • the Widget's On series function is used to trigger.
  • the widget's event response is to achieve compatibility with the general game engine for UMG support. That is to say, the virtual reality content developer can use the general UI production method to create a user interface (UI) menu for the virtual reality scene, and the menu can be directly applied to the virtual reality scene for interaction.
  • UI user interface
  • the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like.
  • a click operation as an example can be, but is not limited to, determined by the following events:
  • the position where the ray coincides with the final target object (such as the right foot of the object Y) is selected, and then the coincident position (such as the right foot of the object Y) is selected.
  • the control performs a click operation, for example, detecting a start click event in which the interactive button is pressed and an end click event when the interactive button is raised, and then confirming that the click operation is performed on the above control.
  • the interactive control of the right foot of the character character Y corresponding to the object Y is realized, for example, by clicking the right foot to control the raising of the right foot to perform the kicking action.
  • the above is only an example, and is not limited in this embodiment.
  • the control is operated by selecting a control at a position where the ray coincides with the final target object in the final target object.
  • the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation.
  • the technical solution of the present application which is essential or contributes to the related art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM).
  • the instructions include a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present application.
  • an interaction apparatus for implementing a virtual reality scenario of the interaction method of the virtual reality scenario described above is further provided.
  • the apparatus may include:
  • a determining unit 802 configured to determine, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, wherein the ray is displayed in the virtual reality scene;
  • a detecting unit 804 configured to detect a final target object colliding with the ray in the initial target object
  • An operation unit 806, configured to operate on the control selected by the ray in the final target object.
  • the interaction device of the virtual reality scenario may be, but is not limited to, being applied to a virtual reality interactive application using a virtual reality device.
  • the virtual reality interaction application may include, but is not limited to, virtual reality. Games, virtual reality video playback, virtual reality shopping, and more.
  • the above is only an example, and is not limited in this embodiment.
  • the virtual reality device may include, but is not limited to, VR glasses.
  • the above interaction process may be, but is not limited to, interacting with objects in a plane in a virtual reality scene, for example, as shown in FIG. 3, which is shown in the dotted line box as VR glasses (device 102 for virtual reality scene interaction).
  • Displaying the virtual reality scene content displaying the object A to the object E to be interacted in the two-dimensional plane, wherein the final target object colliding with the ray is the object E; further, in the embodiment, the interaction process may be It is not limited to interacting with a three-dimensional character object in a virtual reality scene.
  • the virtual reality scene content displayed in the VR glasses is shown in the dotted line box:
  • the object P to be interacted, the object X, the object Y, and the object Z are displayed in the three-dimensional space, wherein the final target object colliding with the ray is the object Y.
  • the above is only an example, and is not limited in this embodiment.
  • the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
  • the above collision detection (also referred to as collision detection) generally refers to a method of determining whether two or more objects generate an intersection. It can be applied to video games and other computational physics, as well as to artificial intelligence. In addition to being used to determine if two objects have collided, it can also be used to calculate the time of impact (TOI) and to obtain the location of the object's cross collision.
  • TOI time of impact
  • determining, in the object displayed in the virtual reality scene, the initial target object that is allowed to collide with the ray comprises: determining, according to the object type of the object, a target object having a corresponding relationship with the ray type of the ray Type to determine the object of the target object type as the initial target object that is allowed to collide with the ray.
  • the mapping relationship between the ray type and the object type is used to determine the initial target object that is allowed to collide with the ray, so as to avoid the ray-independent object participating in the interactive judgment process in the virtual reality scene, reducing the judgment time, thereby achieving simplified interaction. Determine the effect of the step.
  • detecting the final target object that collides with the ray in the initial target object includes: traversing each initial target object, and detecting whether the space occupied by each initial target object in the virtual reality scene is There is a portion that coincides with the ray; an initial target object having a portion that coincides with the ray is determined as the final target object.
  • the ray may be, but is not limited to, a vector having a start point and an end point.
  • the foregoing detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may but not It is limited to: detecting whether or not the point in the vector formed by the above-mentioned rays is included in the space. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray.
  • the collision detection may be performed for each frame to determine whether the space occupied by the virtual reality scene includes the above-mentioned rays. Points in the vector to ensure the accuracy of collision detection.
  • the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like.
  • the execution event corresponding to the above operation may include, but is not limited to, at least one of the following:
  • Enter event The ray starts to point to an object, and compares the change of the hit object list of the ray of the previous frame and the previous frame to see if there is a newly added object, triggering the event of the newly added object;
  • controls may be, but are not limited to, a series of pre-made functional controls for constructing an interface, such as buttons, check boxes, sliders, progress bars, and the like.
  • a series of pre-made functional controls for constructing an interface such as buttons, check boxes, sliders, progress bars, and the like.
  • the above is only an example, and is not limited in this embodiment.
  • the ray is displayed in the virtual reality scene, and then detected in the initial target object.
  • the final target object in which the ray collides, operating on the ray-selected controls in the final target object.
  • the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology.
  • the determining unit 802 includes:
  • a first determining module configured to determine, in the object type, a target object type having a corresponding relationship with a ray type of the ray;
  • the second determining module is configured to determine an object of the type of the target object type as an initial target object in the object.
  • the type of the object that allows collision with the ray is set as the target object type, represented by the object collision object, and the type of the ray for collision detection is represented by a laser collision object.
  • the target object type represented by the object collision object
  • the type of the ray for collision detection is represented by a laser collision object.
  • the collision mode for performing the ray collision detection may be, but not limited to, using the collision bounding box in the related art, and detecting the collision surrounding by surrounding the detected individual with the collision bounding box. Whether the box has an intersection, and in the case of an intersection, it is detected as a collision.
  • the manner of collision detection is not limited, and other collision detection methods may also be adopted.
  • collision detection is performed on the target object type corresponding to the ray type, thereby directly skipping the object that is not the target object type.
  • the detection reaches the number of objects that reduce the collision detection by the ray, and the effect of greatly reducing the time consumption of the collision detection is realized, thereby achieving the effect of simplifying the interactive judgment step.
  • the detecting unit 804 includes:
  • a processing module configured to perform the following steps on each object in the initial target object, wherein the initial target object is treated as the current target object when performing the following steps:
  • the current target object is determined as the final target object.
  • the traversal determination process may be performed on the initial target object determined to be the target object type, where each initial target object is respectively used as the current target object: detecting the current target object in the virtual reality Whether the space occupied by the scene has a portion coincident with the ray; the initial target object of the portion where the ray coincides is determined as the final target object.
  • the ray may be, but is not limited to, a vector having a starting point and an ending point.
  • the detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may be, but is not limited to, detecting whether the space includes a point in the vector formed by the ray. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray.
  • the space occupied by the current target object in the virtual reality scene may be, but is not limited to, as shown in FIG. 3 .
  • the space occupied by the object E in the virtual reality scene is a rectangular plane area; As shown in FIG. 4, taking the object Y as an example, the space occupied by the object Y in the virtual reality scene is a three-dimensional space occupied by the character character Y in the three-dimensional space.
  • the following example is used. For example, taking the object E shown in FIG. 3 as an example, if it is detected that there is a cross between the rectangular plane regions corresponding to the object E, it is possible to detect that the object E has a portion overlapping with the ray, and the object can be detected. E is determined as the final target object. For example, taking the object Y shown in FIG. 4 as an example, if it is detected that the three-dimensional space occupied by the persona Y corresponding to the object Y intersects, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be detected. Determined as the final target object.
  • each initial target object by traversing each initial target object, it is sequentially determined whether the space occupied by each initial target object in the virtual reality scene has a portion overlapping with the ray, so as to accurately detect the interaction for the interaction according to the determination result.
  • the ultimate target object ensures the accuracy of the interaction.
  • the processing module implements the following steps to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray:
  • S1 detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
  • the ray may be, but is not limited to, a directional vector including a starting point and an ending point.
  • the starting point may be, but not limited to, a position where a ray is emitted in a virtual reality scene, and an end point is a position that arrives after extending a certain distance according to a direction indicated by the ray, and collision detection is required at each position on the ray.
  • the starting point takes the position of the finger in the virtual reality scene (as indicated by Hand Position) as an example, according to the extended distance of the ray set in advance (as indicated by Max Distance), the corresponding point is obtained.
  • the end point (as indicated by the Max Range Position) detects whether the space occupied by the object Y includes the point on the above-mentioned ray according to the direction of the finger.
  • the collision detection result indicates that the stereoscopic space occupied by the persona Y corresponding to the object Y intersects with the ray (the starting point is the Hand Position and the end point is the Max Range Position), and the intersection point is as shown in FIG. 6 .
  • the position is displayed, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be determined as the final target object.
  • the processing module determines the end point by determining the end point according to the position of the starting point in the virtual reality scene, the direction vector for indicating the direction, and the predetermined determined distance range value. The location in the virtual reality scene.
  • the above Hand Forward Vector is used to represent a unit vector of a ray direction. That is to say, on the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the extending distance in the ray direction are superimposed, thereby obtaining the three-dimensional coordinates of the end point.
  • the present application by detecting whether the space includes a point on the ray, it is possible to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray, that is, in the virtual reality scene.
  • the space occupied and the position of each point on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray, thereby ensuring the accuracy of the collision detection, thereby achieving the effect of improving the interaction accuracy.
  • the operating unit 806 includes:
  • the operation module is set to operate on the control.
  • the operation module includes:
  • a first determining submodule configured to determine that a start click event is detected when detecting that an interactive button corresponding to the virtual reality scene is pressed
  • the third determining sub-module is configured to perform a click operation on the control when the start click event and the end click event are detected.
  • the objects in the virtual reality scene may include, but are not limited to, an object designed by an Unreal Mobile UI designer (referred to as a UMG object), and an object in the target object type.
  • UMG object an object designed by an Unreal Mobile UI designer
  • the UMG-related control logic needs to be called.
  • the Widget's On series function is used to trigger.
  • the widget's event response is to achieve compatibility with the general game engine for UMG support. That is to say, the virtual reality content developer can use the general UI production method to create a user interface (UI) menu for the virtual reality scene, and the menu can be directly applied to the virtual reality scene for interaction.
  • UI user interface
  • the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like.
  • a click operation as an example can be, but is not limited to, determined by the following events:
  • the position where the ray coincides with the final target object (such as the right foot of the object Y) is selected, and then the coincident position (such as the right foot of the object Y) is selected.
  • the control performs a click operation, for example, detecting a start click event in which the interactive button is pressed and an end click event when the interactive button is raised, and then confirming that the click operation is performed on the above control.
  • the interactive control of the right foot of the character character Y corresponding to the object Y is realized, for example, by clicking the right foot to control the raising of the right foot to perform the kicking action.
  • the above is only an example, and is not limited in this embodiment.
  • the control is operated by selecting a control at a position where the ray coincides with the final target object in the final target object.
  • the above modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above embodiment 1. It should be noted that the foregoing module may be implemented in a hardware environment as shown in FIG. 1 as part of the device, and may be implemented by software or by hardware, where the hardware environment includes a network environment.
  • an electronic device wherein the electronic device comprises: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the virtual reality scene described above by using a computer program Interactive method.
  • the electronic device may be an interactive terminal of a virtual reality scenario for implementing the interaction method of the virtual reality scenario. As shown in FIG. 9, the terminal includes:
  • a communication interface 902 configured to acquire a ray displayed in a virtual reality scene
  • the processor 904 is connected to the communication interface 902, and is configured to determine, in the object displayed in the virtual reality scene, an initial target object that allows collision with the ray, wherein the ray is displayed in the virtual reality scene; A final target object that collides with the ray is detected in the target object; and is also set to operate on the ray selected control in the final target object;
  • the memory 908 is connected to the communication interface 902, the processor 904, and the display 906, and is configured to store the initial target object, the final target object, and the ray position information.
  • the terminal may also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palmtop computer, and a mobile Internet device (Mobile Internet). Devices, MID), PAD and other equipment.
  • Fig. 9 does not limit the structure of the above terminal.
  • the terminal may also include more or less components (such as a network interface, etc.) than shown in FIG. 9, or have a different configuration than that shown in FIG.
  • the memory 908 can be used to store software programs and modules, such as the interactive method of the virtual reality scene and the program instructions/modules corresponding to the device in the embodiment of the present invention.
  • the processor 904 runs the software program and the module stored in the memory 908. Thereby performing various functional applications and data processing, that is, implementing the above-described interactive method of the virtual reality scene.
  • Memory 908 can include high speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory.
  • memory 908 can further include memory remotely located relative to processor 904, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
  • the communication interface 902 described above is for receiving or transmitting data via a network.
  • Specific examples of the above network may include a wired network and a wireless network.
  • communication interface 902 includes a Network Interface Controller (NIC) that can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network.
  • NIC Network Interface Controller
  • the communication interface 902 is a Radio Frequency (RF) module for communicating with the Internet wirelessly.
  • RF Radio Frequency
  • the memory 908 is configured to store content such as a target object, a correspondence relationship between a ray type and a target object type, and the like.
  • a storage medium is also provided.
  • the foregoing storage medium may be located on at least one of the plurality of network devices in the network shown in the foregoing embodiment.
  • the storage medium is arranged to store a computer program for performing the following steps:
  • S3 operates on the control selected by the ray in the final target object.
  • the storage medium is arranged to store a computer program for performing the following steps:
  • the storage medium is arranged to store a computer program for performing the following steps:
  • the current target object is determined as the final target object.
  • the storage medium is arranged to store a computer program for performing the following steps:
  • S1 detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
  • the storage medium is arranged to store a computer program for performing the following steps:
  • the storage medium is arranged to store a computer program for performing the following steps:
  • the storage medium is arranged to store a computer program for performing the following steps:
  • the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory.
  • ROM Read-Only Memory
  • RAM Random Access Memory
  • mobile hard disk a magnetic memory.
  • magnetic memory a variety of media that can store computer programs, such as a disc or an optical disc.
  • the integrated unit in the above embodiment if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in the above-described computer readable storage medium.
  • the technical solution of the present application may be embodied in the form of a software product, or the whole or part of the technical solution, which is stored in the storage medium, including
  • the instructions are used to cause one or more computer devices (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
  • the disclosed client may be implemented in other manners.
  • the device embodiments described above are only schematic.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.

Abstract

An interaction method and apparatus for a virtual reality scene, a storage medium and an electronic apparatus. The method comprises: determining, from objects displayed in a virtual reality scene, initial target objects that are allowed to collide with rays, wherein the rays are displayed in the virtual reality scene (S202); detecting, from the initial target objects, a final target object that collides with the rays (S204); and operating a control selected by the rays in the final target object (S206). The solution solves the technical problem in the related art that interaction with an object in a virtual reality scene is yet not achieved.

Description

虚拟现实场景的交互方法和装置、存储介质及电子装置Interactive method and device for virtual reality scene, storage medium and electronic device
本申请要求于2017年4月20日提交中国专利局、优先权号为2017102637592、申请名称为“虚拟现实场景的交互方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. 2017102637592, filed on Apr. 20, 2017, the entire disclosure of which is incorporated herein by reference. In the application.
技术领域Technical field
本申请涉及计算机领域,具体而言,涉及一种虚拟现实场景的交互方法和装置、存储介质及电子装置。The present application relates to the field of computers, and in particular, to a method and device for interacting with a virtual reality scene, a storage medium, and an electronic device.
背景技术Background technique
如今,为了使用户体验身临其境,真正感受三维空间内的事物。越来越多的应用开发商开始关注在虚拟现实场景下的应用。其中,虚拟现实(Virtual Reality,简称VR)技术,是利用计算机模拟产生一个三维空间的虚拟世界,提供用户各种感官模拟体验,在用户执行移动时,计算机通过复杂的三维运算,以增强用户在三维世界的真实临场感。Today, in order to make the user experience immersive, really feel the things in the three-dimensional space. More and more application developers are beginning to pay attention to applications in virtual reality scenarios. Among them, Virtual Reality (VR) technology is a virtual world that uses computer simulation to generate a three-dimensional space, providing users with various sensory simulation experiences. When users perform movement, the computer uses complex three-dimensional operations to enhance users. The true presence of the three-dimensional world.
目前,相关技术中常用的交互方式包括:鼠标交互。其中,鼠标交互对于任何一个程序的选择方式包括:Currently, interaction methods commonly used in related technologies include: mouse interaction. Among them, the mouse interaction for any program selection includes:
1)对于二维世界,所显示的对象在二维(简称2D)屏幕上均具有对应的位置,通过鼠标在2D屏幕上点击上述对象所在位置,就可以实现与该对象的交互过程。1) For the two-dimensional world, the displayed object has a corresponding position on the two-dimensional (2D) screen, and the interaction process with the object can be realized by clicking the position of the object on the 2D screen by the mouse.
2)对于平面显示器显示的三维世界,先在二维(简称2D)屏幕上选定一个点A,再在与2D屏幕对应的三维(简称3D)空间中,获得所选定的点A对应到3D的虚拟空间中的位置B,通过点A和位置B,就可以确定所要交互的对象,以实现通过鼠标交互完成在平面显示器中显示的三维世界的交互过程。也就是说,平面显示器显示的三维世界中参与交互的仍 然是体现二维平面空间中的对象,在交互过程中,鼠标仍然是与二维平面空间中的对象实现交互。2) For the three-dimensional world displayed by the flat panel display, first select a point A on the two-dimensional (2D) screen, and then obtain the selected point A corresponding to the three-dimensional (3D) space corresponding to the 2D screen. The position B in the 3D virtual space, through the point A and the position B, can determine the object to be interacted, so as to realize the interaction process of the three-dimensional world displayed in the flat display by mouse interaction. That is to say, the interactive interaction in the three-dimensional world displayed by the flat panel display still reflects the objects in the two-dimensional plane space. During the interaction, the mouse still interacts with the objects in the two-dimensional plane space.
然而,目前相关技术中提供的鼠标交互方式,主要应用于与二维平面空间所显示的对象进行交互,而对于虚拟现实VR场景中的三维对象,还并未提供一种操作简化的交互方式。However, the mouse interaction mode provided in the related art is mainly applied to interact with an object displayed in a two-dimensional plane space, and a three-dimensional object in a virtual reality VR scene does not provide a simplified interaction mode.
针对上述的问题,目前尚未提出有效的解决方案。In response to the above problems, no effective solution has been proposed yet.
发明内容Summary of the invention
本申请实施例提供了一种虚拟现实场景的交互方法和装置、存储介质及电子装置,以至少解决相关技术中还无法实现与虚拟现实场景中的对象进行交互的技术问题。The embodiments of the present application provide a method and device for interacting with a virtual reality scenario, a storage medium, and an electronic device, so as to at least solve the technical problem that the related art cannot perform interaction with an object in a virtual reality scenario.
根据本申请实施例的一个方面,提供了一种虚拟现实场景的交互方法,包括:在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,上述虚拟现实场景中显示有上述射线;在上述初始目标对象中检测出与上述射线发生碰撞的最终目标对象;对上述最终目标对象中上述射线所选中的控件进行操作。According to an aspect of the embodiments of the present application, an interaction method of a virtual reality scene is provided, including: determining, in an object displayed in a virtual reality scene, an initial target object that is allowed to collide with a ray, wherein the virtual reality scene is The ray is displayed; a final target object colliding with the ray is detected in the initial target object; and the control selected by the ray in the final target object is operated.
根据本申请实施例的另一方面,还提供了一种虚拟现实场景的交互装置,包括:确定单元,设置为在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,上述虚拟现实场景中显示有上述射线;检测单元,设置为在上述初始目标对象中检测出与上述射线发生碰撞的最终目标对象;操作单元,设置为对上述最终目标对象中上述射线所选中的控件进行操作。According to another aspect of the embodiments of the present application, there is also provided an interaction device for a virtual reality scene, comprising: a determining unit configured to determine, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, Wherein the ray is displayed in the virtual reality scene; the detecting unit is configured to detect a final target object colliding with the ray in the initial target object; and the operating unit is configured to select the ray in the final target object The controls operate.
根据本申请的实施例的又一方面,还提供了一种电子装置,包括存储器、处理器及存储在上述存储器上并可在上述处理器上运行的计算机程序,上述处理器通过上述计算机程序执行上述任一项方法实施例中的步骤。According to still another aspect of an embodiment of the present application, there is provided an electronic device comprising a memory, a processor, and a computer program stored on the memory and operable on the processor, wherein the processor is executed by the computer program The steps in any of the above method embodiments.
根据本申请的实施例的又一方面,还提供了一种存储介质,该存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to still another aspect of an embodiment of the present application, there is also provided a storage medium having stored therein a computer program, wherein the computer program is configured to execute the steps of any one of the method embodiments described above.
在本申请实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。进一步,通过射线碰撞检测实现与虚拟现实场景中的对象进行交互,还简化了交互操作,而无需使用鼠标等硬件设备进行复杂的交互运算,进而达到在保证交互准确性的情况下,提高交互效率的效果。In the embodiment of the present application, after the initial target object that allows collision with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and the ray is detected in the initial target object. The final target object in which the collision occurred, operates on the control selected by the ray in the final target object. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene. Further, the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
附图说明DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the present application, and are intended to be a part of this application. In the drawing:
图1是根据本申请实施例的虚拟现实场景的交互方法的硬件环境的示意图;1 is a schematic diagram of a hardware environment of an interaction method of a virtual reality scenario according to an embodiment of the present application;
图2是根据本申请实施例的一种可选的虚拟现实场景的交互方法的流程图;2 is a flowchart of an optional interaction method of a virtual reality scene according to an embodiment of the present application;
图3是根据本申请实施例的一种可选的虚拟现实场景的交互方法的示意图;FIG. 3 is a schematic diagram of an optional interaction method of a virtual reality scene according to an embodiment of the present application; FIG.
图4是根据本申请实施例的另一种可选的虚拟现实场景的交互方法的示意图;4 is a schematic diagram of another optional interaction method of a virtual reality scene according to an embodiment of the present application;
图5是根据本申请实施例的又一种可选的虚拟现实场景的交互方法的示意图;FIG. 5 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application; FIG.
图6是根据本申请实施例的又一种可选的虚拟现实场景的交互方法的 示意图;FIG. 6 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application; FIG.
图7是根据本申请实施例的又一种可选的虚拟现实场景的交互方法的示意图;FIG. 7 is a schematic diagram of still another optional interaction method of a virtual reality scene according to an embodiment of the present application; FIG.
图8是根据本申请实施例的一种可选的虚拟现实场景的交互装置的示意图;FIG. 8 is a schematic diagram of an optional virtual reality scene interaction apparatus according to an embodiment of the present application; FIG.
图9是根据本申请实施例的一种虚拟现实场景的交互终端的结构框图。FIG. 9 is a structural block diagram of an interaction terminal of a virtual reality scenario according to an embodiment of the present application.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application. It is an embodiment of the present application, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope shall fall within the scope of the application.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or order. It is to be understood that the data so used may be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "comprises" and "comprises" and "the" and "the" are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that comprises a series of steps or units is not necessarily limited to Those steps or units may include other steps or units not explicitly listed or inherent to such processes, methods, products or devices.
申请根据本申请实施例的一个方面,提供了一种上述虚拟现实场景的交互方法的实施例。作为一种可选的实施方式,该虚拟现实场景的交互方法可以但不限于应用于如图1所示的应用环境中,用于实现虚拟现实(Virtual Reality,简称VR)场景交互的设备102中显示有待交互的对象,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,虚拟现实场景中显示有射线;在初始目标对象中检测出与射 线发生碰撞的最终目标对象;然后对最终目标对象中射线所选中的控件进行操作。Application According to an aspect of an embodiment of the present application, an embodiment of an interaction method of the above virtual reality scenario is provided. As an optional implementation manner, the interaction method of the virtual reality scenario may be, but is not limited to, applied to the device 102 for implementing virtual reality (VR) scenario interaction in the application environment as shown in FIG. Displaying an object to be interacted, and determining an initial target object that allows collision with the ray in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene; and the final collision with the ray is detected in the initial target object The target object; then the controls in the ray selection in the final target object are manipulated.
在本实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。In this embodiment, after the initial target object that allows collision with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and the ray occurrence is detected in the initial target object. The final target object of the collision, which operates on the controls selected by the ray in the final target object. Thereby, the final target object to be interacted in the virtual reality scene is acquired by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the object in the virtual reality scene in the related art. The problem of precise interaction.
可选地,在本实施例中,上述用于实现虚拟现实场景交互的设备可以包括但不限于以下至少之一:VR眼镜,及其他用于实现虚拟现实场景交互的硬件设备。上述只是一种示例,本实施例对此不做任何限定。Optionally, in this embodiment, the foregoing apparatus for implementing virtual reality scene interaction may include, but is not limited to, at least one of the following: VR glasses, and other hardware devices for implementing virtual reality scene interaction. The above is only an example, and the embodiment does not limit this.
根据本申请实施例,提供了一种虚拟现实场景的交互方法,如图2所示,该方法包括:According to an embodiment of the present application, a method for interacting a virtual reality scenario is provided. As shown in FIG. 2, the method includes:
S202,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,虚拟现实场景中显示有射线;S202. Determine, in an object displayed in the virtual reality scene, an initial target object that is allowed to collide with the ray, where the ray is displayed in the virtual reality scene;
S204,在初始目标对象中检测出与射线发生碰撞的最终目标对象;S204: detecting a final target object that collides with the ray in the initial target object;
S206,对最终目标对象中射线所选中的控件进行操作。S206: Operate the control selected in the ray of the final target object.
可选地,在本实施例中,上述虚拟现实场景的交互方法可以但不限于应用于使用虚拟现实设备进行虚拟现实交互应用的过程中,例如,上述虚拟现实交互应用可以包括但不限于虚拟现实游戏、虚拟现实影视播放、虚拟现实购物等等。上述仅是一种示例,本实施例中对此不做任何限定。其中,该虚拟现实设备可以包括但不限于VR眼镜。进一步,上述交互过程可以但不限于与虚拟现实场景中的平面中的对象进行交互,例如,如图3所示,虚线方框内所示为VR眼镜(虚拟现实场景交互的设备102)中所显示的虚拟现实场景内容:在二维平面内显示有待交互的对象A至对象E, 其中,与射线发生碰撞的最终目标对象为对象E;此外,在本实施例中,上述交互过程也可以但不限于与虚拟现实场景中的三维角色对象进行交互,例如,如图4所示,虚线方框内所示为VR眼镜(虚拟现实场景交互的设备102)中所显示的虚拟现实场景内容:在三维空间内显示有待交互的对象P、对象X、对象Y及对象Z,其中,与射线发生碰撞的最终目标对象为对象Y。上述仅是一种示例,本实施例中对此不做任何限定。Optionally, in this embodiment, the interaction method of the virtual reality scenario may be, but is not limited to, being applied to a virtual reality interactive application using a virtual reality device. For example, the virtual reality interaction application may include but is not limited to virtual reality. Games, virtual reality video playback, virtual reality shopping, and more. The above is only an example, and is not limited in this embodiment. The virtual reality device may include, but is not limited to, VR glasses. Further, the above interaction process may be, but is not limited to, interacting with objects in a plane in a virtual reality scene, for example, as shown in FIG. 3, which is shown in the dotted line box as VR glasses (device 102 for virtual reality scene interaction). The displayed virtual reality scene content: the object A to the object E to be interacted in the two-dimensional plane, wherein the final target object colliding with the ray is the object E; further, in the embodiment, the interaction process may be It is not limited to interacting with a three-dimensional character object in a virtual reality scene. For example, as shown in FIG. 4, the virtual reality scene content displayed in the VR glasses (the device 102 of the virtual reality scene interaction) is shown in the dotted line box: The object P to be interacted, the object X, the object Y, and the object Z are displayed in the three-dimensional space, wherein the final target object colliding with the ray is the object Y. The above is only an example, and is not limited in this embodiment.
需要说明的是,在本实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。进一步,通过射线碰撞检测实现与虚拟现实场景中的对象进行交互,还简化了交互操作,而无需使用鼠标等硬件设备进行复杂的交互运算,进而达到在保证交互准确性的情况下,提高交互效率的效果。It should be noted that, in this embodiment, after the initial target object that is allowed to collide with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and then in the initial target object. A final target object that collides with the ray is detected, and the control selected in the ray of the final target object is operated. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene. Further, the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
此外,在本实施例中,上述碰撞检测(也称作碰撞侦测(Collision detection)),通常是指一种判断两个或多个对象是否产生交集的方法。可以应用于电子游戏和其他计算物理学中,也可以应用于人工智能中。除了可以用于确定两个对象是否已经碰撞,还可以用于计算冲击的时间(TOI),以及获取对象交叉碰撞的位置。Further, in the present embodiment, the above collision detection (also referred to as collision detection) generally refers to a method of determining whether two or more objects generate an intersection. It can be applied to video games and other computational physics, as well as to artificial intelligence. In addition to being used to determine if two objects have collided, it can also be used to calculate the time of impact (TOI) and to obtain the location of the object's cross collision.
可选地,在本实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象包括:根据对象的对象类型确定出与射线的射线类型具有对应关系的目标对象类型,以将目标对象类型的对象确定为允许与射线发生碰撞的初始目标对象。从而实现利用射线类型及对象类型之间的映射关系,确定出允许与射线发生碰撞的初始目标对象,以避免虚拟现实场景中与射线无关的对象参与交互判断过程,减少判断时间,进 而达到简化交互判断步骤的效果。Optionally, in this embodiment, determining, in the object displayed in the virtual reality scene, the initial target object that is allowed to collide with the ray comprises: determining, according to the object type of the object, a target object having a corresponding relationship with the ray type of the ray Type to determine the object of the target object type as the initial target object that is allowed to collide with the ray. Thereby, the mapping relationship between the ray type and the object type is used to determine the initial target object that is allowed to collide with the ray, so as to avoid the ray-independent object participating in the interactive judgment process in the virtual reality scene, reducing the judgment time, thereby achieving simplified interaction. Determine the effect of the step.
可选地,在本实施例中,在初始目标对象中检测出与射线发生碰撞的最终目标对象包括:遍历每个初始目标对象,检测每个初始目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;将存在与射线重合的部分的初始目标对象确定为最终目标对象。Optionally, in the embodiment, detecting the final target object that collides with the ray in the initial target object includes: traversing each initial target object, and detecting whether the space occupied by each initial target object in the virtual reality scene is There is a portion that coincides with the ray; an initial target object having a portion that coincides with the ray is determined as the final target object.
需要说明的是,在本实施例中,上述射线可以但不限于为具有起始点和终点的向量,上述检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分可以但不限于:检测上述空间中是否包含上述射线构成的向量中的点。也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线碰撞的最终目标对象的效果。此外,若虚拟现实场景所显示的多帧画面,则在本实施例中,可以但不限于对每一帧都做碰撞检测,以确定虚拟现实场景中所占的空间中是否包含上述射线构成的向量中的点,从而保证碰撞检测的精确度。It should be noted that, in this embodiment, the ray may be, but is not limited to, a vector having a start point and an end point. The foregoing detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may but not It is limited to: detecting whether or not the point in the vector formed by the above-mentioned rays is included in the space. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray. In addition, if the multi-frame picture is displayed in the virtual reality scene, in the embodiment, the collision detection may be performed for each frame to determine whether the space occupied by the virtual reality scene includes the above-mentioned rays. Points in the vector to ensure the accuracy of collision detection.
可选地,在本实施例中,利用射线所进行的操作可以包括但不限于:点击操作、移动操作、选中操作等等。与上述操作对应的执行事件可以包括但不限于以下至少之一:Optionally, in the embodiment, the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like. The execution event corresponding to the above operation may include, but is not limited to, at least one of the following:
1)进入事件(Enter):射线开始指向某一个对象,通过比较这一帧和上一帧的射线的击中对象列表的变化,看是否存在新添加的对象,触发新添加对象的事件;1) Enter event (Enter): The ray starts to point to an object, and compares the change of the hit object list of the ray of the previous frame and the previous frame to see if there is a newly added object, triggering the event of the newly added object;
2)离开事件(Leave):射线离开指向某一个对象,通过比较这一帧和上一帧的射线的击中对象列表的变化,看是否存在新删除的对象,触发新删除对象的事件;2) Leave event: The ray leaves to point to an object, and compares the change of the hit list of the ray of the previous frame and the previous frame to see if there is a newly deleted object, triggering the event of the newly deleted object;
3)按下事件(TouchDown):射线指向控件,按下交互按键的时候,触发交互列表中所有对象的事件;3) Pressing the event (TouchDown): the ray pointing control, when pressing the interactive button, triggers the event of all objects in the interaction list;
4)抬起事件(TouchUp):射线指向控件,抬起交互按键的时候,触发交互列表中所有对象的事件;4) LiftUp: The ray pointing control, when the interactive button is raised, triggers the events of all objects in the interaction list;
5)移动事件(Move):射线在最终目标对象中的各个控件上移动,触发交互列表中所有对象的事件。5) Move: The ray moves on each control in the final target object, triggering events for all objects in the interaction list.
6)其他:对于一些特殊的事件,比如拖动操作触发的拖动事件等等。6) Other: For some special events, such as drag events triggered by drag operations, and so on.
需要说明的是,上述控件可以但不限于为用于构成界面的一系列预先制作的功能控件,例如,按钮,复选框,滑块,进度条等。上述仅是一种示例,本实施例中对此不做任何限定。It should be noted that the above controls may be, but are not limited to, a series of pre-made functional controls for constructing an interface, such as buttons, check boxes, sliders, progress bars, and the like. The above is only an example, and is not limited in this embodiment.
通过本申请提供的实施例,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。With the embodiment provided by the present application, after the initial target object that allows the collision with the ray is determined in the object displayed in the virtual reality scene, the ray is displayed in the virtual reality scene, and then detected in the initial target object. The final target object in which the ray collides, operating on the ray-selected controls in the final target object. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene.
作为一种可选的方案,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象包括:As an alternative, determining an initial target object that is allowed to collide with the ray in the object displayed in the virtual reality scene includes:
S1,获取对象的对象类型;S1, obtaining an object type of the object;
S2,在对象类型中确定出与射线的射线类型具有对应关系的目标对象类型;S2, determining, in the object type, a target object type having a correspondence relationship with a ray type of the ray;
S3,在对象中将类型为目标对象类型的对象确定为初始目标对象。S3, determining an object of the type of the target object type as an initial target object in the object.
可选地,在本实施例中,对允许与射线发生碰撞的对象的类型设置为目标对象类型,用object collision对象表示,将用于碰撞检测的射线类型用laser collision对象表示。上述仅是一种示例,本实施例中对此不做任何限定。Alternatively, in the present embodiment, the type of the object that allows collision with the ray is set as the target object type, represented by the object collision object, and the type of the ray for collision detection is represented by a laser collision object. The above is only an example, and is not limited in this embodiment.
需要说明的是,在本实施例中,上述用于进行射线碰撞检测的碰撞方式可以但不限于使用相关技术中的碰撞包围盒,通过将被检测的个体用碰 撞包围盒包围,检测各个碰撞包围盒是否有交叉,对于产生交叉的情况,检测出为产生碰撞。上述仅是一种示例,本实施例中对碰撞检测的方式不做限定,还可以采用其他碰撞检测方式。It should be noted that, in the embodiment, the collision mode for performing the ray collision detection may be, but not limited to, using the collision bounding box in the related art, and detecting the collision surrounding by surrounding the detected individual with the collision bounding box. Whether the box has an intersection, and in the case of an intersection, it is detected as a collision. The foregoing is only an example. In this embodiment, the manner of collision detection is not limited, and other collision detection methods may also be adopted.
通过本申请提供的实施例,通过对虚拟现实场景中的对象按类型进行分类,以实现对与射线类型具有对应关系的目标对象类型进行碰撞检测,从而实现对于不是目标对象类型的对象直接略过检测,达到射线减少碰撞检测的对象的数量,实现大大节约碰撞检测的时间消耗的效果,进而达到简化交互判断步骤的效果。Through the embodiment provided by the present application, by classifying the objects in the virtual reality scene by type, collision detection is performed on the target object type corresponding to the ray type, thereby directly skipping the object that is not the target object type. The detection reaches the number of objects that reduce the collision detection by the ray, and the effect of greatly reducing the time consumption of the collision detection is realized, thereby achieving the effect of simplifying the interactive judgment step.
作为一种可选的方案,在初始目标对象中检测出与射线发生碰撞的最终目标对象包括:As an alternative, detecting the final target object that collides with the ray in the initial target object includes:
S1,对初始目标对象中的每个对象执行以下步骤,其中,初始目标对象在执行以下步骤时被视为当前目标对象:S1, performing the following steps on each object in the initial target object, wherein the initial target object is regarded as the current target object when performing the following steps:
S11,检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;S11, detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray;
S12,若空间存在与射线重合的部分,则将当前目标对象确定为最终目标对象。S12. If the space has a portion that coincides with the ray, the current target object is determined as the final target object.
可选地,在本实施例中,可以但不限于对确定为目标对象类型的初始目标对象执行遍历判断过程,其中,分别将每个初始目标对象作为当前目标对象:检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;将存在与射线重合的部分的初始目标对象确定为最终目标对象。Optionally, in this embodiment, the traversal determination process may be performed on the initial target object determined to be the target object type, where each initial target object is respectively used as the current target object: detecting the current target object in the virtual reality Whether the space occupied by the scene has a portion coincident with the ray; the initial target object of the portion where the ray coincides is determined as the final target object.
需要说明的是,在本实施例中,上述射线可以但不限于为具有起始点和终点的向量。在本实施例中,上述检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分可以但不限于:检测上述空间中是否包含上述射线构成的向量中的点。也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线 碰撞的最终目标对象的效果。其中,上述当前目标对象在虚拟现实场景中所占的空间可以但不限于如图3所示,以对象E为例,对象E在虚拟现实场景中所占的空间为一个矩形平面区域;如图4所示,以对象Y为例,对象Y在虚拟现实场景中所占的空间为一个人物角色Y在三维空间中所占用的立体空间。It should be noted that, in this embodiment, the ray may be, but is not limited to, a vector having a starting point and an ending point. In this embodiment, the detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may be, but is not limited to, detecting whether the space includes a point in the vector formed by the ray. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray. The space occupied by the current target object in the virtual reality scene may be, but is not limited to, as shown in FIG. 3 . Taking the object E as an example, the space occupied by the object E in the virtual reality scene is a rectangular plane area; As shown in FIG. 4, taking the object Y as an example, the space occupied by the object Y in the virtual reality scene is a three-dimensional space occupied by the character character Y in the three-dimensional space.
具体结合以下示例进行说明,例如,以图3所示对象E为例,若检测出射线与对象E对应的矩形平面区域存在交叉,则可检测出对象E存在与射线重合的部分,可将对象E确定为最终目标对象。又例如,以图4所示对象Y为例,若检测出射线与对象Y对应的人物角色Y所占的立体空间存在交叉,则可检测出对象Y存在与射线重合的部分,可将对象Y确定为最终目标对象。Specifically, the following example is used. For example, taking the object E shown in FIG. 3 as an example, if it is detected that there is a cross between the rectangular plane regions corresponding to the object E, it is possible to detect that the object E has a portion overlapping with the ray, and the object can be detected. E is determined as the final target object. For example, taking the object Y shown in FIG. 4 as an example, if it is detected that the three-dimensional space occupied by the persona Y corresponding to the object Y intersects, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be detected. Determined as the final target object.
通过本申请提供的实施例,通过遍历各个初始目标对象,分别依次判断各个初始目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分,以实现根据判断结果准确检测出用于交互的最终目标对象,保证交互的准确性。Through the embodiment provided by the present application, by traversing each initial target object, it is sequentially determined whether the space occupied by each initial target object in the virtual reality scene has a portion overlapping with the ray, so as to accurately detect the interaction for the interaction according to the determination result. The ultimate target object ensures the accuracy of the interaction.
作为一种可选的方案,检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分包括:As an optional solution, detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray includes:
S1,检测空间是否包含射线上的点,其中,射线包括:起始点和终点,射线的方向由起始点指向终点;S1, detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
S2,若检测出空间包含射线上的点,则确定出空间存在与射线重合的部分。S2, if it is detected that the space includes a point on the ray, it is determined that there is a portion where the space overlaps with the ray.
可选地,在本实施例中,上述射线可以但不限于为包括起始点和终点的有向向量。其中,上述起始点可以但不限于为在虚拟现实场景中发出射线的位置,终点是按照射线所指方向延伸一定距离后到达的位置,在这条射线上的每一个位置都需要进行碰撞检测。Optionally, in the embodiment, the ray may be, but is not limited to, a directional vector including a starting point and an ending point. Wherein, the starting point may be, but not limited to, a position where a ray is emitted in a virtual reality scene, and an end point is a position that arrives after extending a certain distance according to a direction indicated by the ray, and collision detection is required at each position on the ray.
例如,如图5所示,假设起始点以手指在虚拟现实场景中的位置(如 用Hand Position表示)为例,根据提前设置好的射线的延伸距离(如用Max Distance表示),获取对应的终点(如用Max Range Position表示),按照手指方向检测对象Y所占空间是否包括上述射线上的点。例如,如图6所示,碰撞检测结果表示:对象Y对应的人物角色Y所占的立体空间与上述射线(起始点为Hand Position,终点为Max Range Position)存在交叉,交叉点为图6所示位置,则可检测出对象Y存在与射线重合的部分,可将对象Y确定为最终目标对象。For example, as shown in FIG. 5, assuming that the starting point takes the position of the finger in the virtual reality scene (as indicated by Hand Position) as an example, according to the extended distance of the ray set in advance (as indicated by Max Distance), the corresponding point is obtained. The end point (as indicated by the Max Range Position) detects whether the space occupied by the object Y includes the point on the above-mentioned ray according to the direction of the finger. For example, as shown in FIG. 6 , the collision detection result indicates that the stereoscopic space occupied by the persona Y corresponding to the object Y intersects with the ray (the starting point is the Hand Position and the end point is the Max Range Position), and the intersection point is as shown in FIG. 6 . When the position is displayed, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be determined as the final target object.
可选地,在本实施例中,通过以下步骤确定终点:根据起始点在虚拟现实场景中的位置、用于指示方向的方向矢量、预定确定的距离范围值,确定出终点在虚拟现实场景中的位置。Optionally, in this embodiment, the end point is determined by determining the end point in the virtual reality scene according to the position of the starting point in the virtual reality scene, the direction vector for indicating the direction, and the predetermined determined distance range value. s position.
例如,如图7所示,用于确定上述射线的终点的公式如下:For example, as shown in FIG. 7, the formula for determining the end point of the above ray is as follows:
Max Range Position=Hand Position+Hand Forward Vector*Max DistanceMax Range Position=Hand Position+Hand Forward Vector*Max Distance
其中,上述Hand Forward Vector用于表示射线方向的单位向量。也就是说在起始点的三维坐标上,叠加沿射线方向上的延伸距离的三维坐标,从而得到终点的三维坐标。Wherein, the above Hand Forward Vector is used to represent a unit vector of a ray direction. That is to say, on the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the extending distance in the ray direction are superimposed, thereby obtaining the three-dimensional coordinates of the end point.
通过本申请提供的实施例,通过检测空间是否包含射线上的点,以实现检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分,也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线碰撞的最终目标对象的效果,从而保证碰撞检测的精确度,进而实现提高交互准确性的效果。Through the embodiment provided by the present application, by detecting whether the space includes a point on the ray, it is possible to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray, that is, in the virtual reality scene. The space occupied and the position of each point on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray, thereby ensuring the accuracy of the collision detection, thereby achieving the effect of improving the interaction accuracy.
作为一种可选的方案,对最终目标对象中射线所选中的控件进行操作包括:As an alternative, operating the controls selected in the ray selection in the final target object includes:
S1,在最终目标对象中选中射线与最终目标对象重合的位置上的控件;S1, in the final target object, select a control at a position where the ray coincides with the final target object;
S2,对控件进行操作。S2, operate on the control.
可选地,在本实施例中,对控件进行操作包括:Optionally, in this embodiment, the operation of the control includes:
S21,在检测到与虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;S21. When detecting that the interactive button corresponding to the virtual reality scene is pressed, determining that the start click event is detected;
S22,在检测到与虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;S22. When detecting that the interactive button corresponding to the virtual reality scene is raised, determining that the end click event is detected;
S23,在检测到开始点击事件和结束点击事件时,对控件进行点击操作。S23, when the start click event and the end click event are detected, the control is clicked.
可选地,在本实施例中,上述虚拟现实场景中对象可以包括但不限于:虚幻动态图形(Unreal Mobile)UI设计器所设计的对象(称作UMG对象),目标对象类型中的对象。Optionally, in this embodiment, the objects in the virtual reality scene may include, but are not limited to, an object designed by an Unreal Mobile UI designer (referred to as a UMG object), and an object in the target object type.
需要说明的是,在本实施例中,如果与射线发生碰撞的是UMG对象,则需调用UMG相关的控制逻辑,例如,在UE4环境中,对于UMG对象,通过调用Widget的On系列函数来触发widget的事件响应,从而达到兼容一般的游戏引擎对于UMG的支持的目的。也就是说,虚拟现实内容开发者可以采用一般UI的制作方法来为虚拟现实场景制作用户界面(User Interface,简称UI)菜单,该菜单可以直接应用于虚拟现实场景进行交互。此外,在本实施例中,如果与射线发生碰撞的不是UMG对象,而是目标对象类型中的对象,则可参照本实施例中记载的交互方式进行交互。It should be noted that, in this embodiment, if a UMG object collides with the ray, the UMG-related control logic needs to be called. For example, in the UE4 environment, for the UMG object, the Widget's On series function is used to trigger. The widget's event response is to achieve compatibility with the general game engine for UMG support. That is to say, the virtual reality content developer can use the general UI production method to create a user interface (UI) menu for the virtual reality scene, and the menu can be directly applied to the virtual reality scene for interaction. Further, in the present embodiment, if the UPG object is collided with the ray, but the object in the target object type, the interaction can be performed with reference to the interactive mode described in the embodiment.
可选地,在本实施例中,利用射线所进行的操作可以包括但不限于:点击操作、移动操作、选中操作等等。上述仅是一种示例,本实施例中对此不做任何限定。例如,以点击操作为例,可以但不限于通过以下事件确定:Optionally, in the embodiment, the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like. The above is only an example, and is not limited in this embodiment. For example, taking a click operation as an example can be, but is not limited to, determined by the following events:
1)按下事件(TouchDown):射线指向控件,按下交互按键的时候,触发交互列表中所有对象的事件。对于UMG直接调用widget已经存在的On系列函数触发已经存在的回调机制,对于其他则自定义该事件的回调函数;1) PressDown: The ray points to the control. When the interactive button is pressed, the events of all objects in the interactive list are triggered. For the UMG directly call the Widget already exists, the On series function triggers the existing callback mechanism, and for others, customizes the callback function of the event;
2)抬起事件(TouchUp):射线指向控件,抬起交互按键的时候,触发交互列表中所有对象的事件。对于UMG直接调用widget已经存在的On系列函数触发已经存在的回调机制,对于其他则自定义该事件的回调函数。2) LiftUp: The ray pointing control, when the interactive button is raised, triggers the events of all objects in the interaction list. For the UMG directly call the Widget already exists, the On series function triggers the existing callback mechanism, and for others, customizes the callback function of the event.
也就是说,在检测到与虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;在检测到与虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;然后在检测到开始点击事件和结束点击事件时,确认对控件进行点击操作。That is, when it is detected that the interactive button corresponding to the virtual reality scene is pressed, it is determined that the start click event is detected; when it is detected that the interactive button corresponding to the virtual reality scene is raised, it is determined that the end click is detected Event; then confirm the click on the control when it detects the start click event and the end click event.
例如,以图5为例,在选中对象Y为最终目标对象时,选中射线与最终目标对象重合的位置(如对象Y的右脚),然后对重合的位置(如对象Y的右脚)上的控件执行点击操作,例如检测到交互按键被按下的开始点击事件及交互按键被抬起时的结束点击事件,则可确认对上述控件执行点击操作。从而实现对对象Y对应的人物角色Y的右脚的交互控制,例如通过点击右脚实现控制抬起右脚执行踢球动作。上述仅是一种示例,本实施例中对此不做任何限定。For example, in FIG. 5, when the selected object Y is the final target object, the position where the ray coincides with the final target object (such as the right foot of the object Y) is selected, and then the coincident position (such as the right foot of the object Y) is selected. The control performs a click operation, for example, detecting a start click event in which the interactive button is pressed and an end click event when the interactive button is raised, and then confirming that the click operation is performed on the above control. Thereby, the interactive control of the right foot of the character character Y corresponding to the object Y is realized, for example, by clicking the right foot to control the raising of the right foot to perform the kicking action. The above is only an example, and is not limited in this embodiment.
通过本申请提供的实施例,在最终目标对象中选中射线与最终目标对象重合的位置上的控件,对该控件进行操作。从而实现在虚拟现实场景中通过射线完成与对象之间的交互,以保证交互准确性。Through the embodiment provided by the present application, the control is operated by selecting a control at a position where the ray coincides with the final target object in the final target object. Thereby, the interaction between the object and the object is completed by the ray in the virtual reality scene to ensure the interaction accuracy.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should understand that the present application is not limited by the described action sequence. Because certain steps may be performed in other sequences or concurrently in accordance with the present application. In the following, those skilled in the art should also understand that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily required by the present application.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分可以以软 件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the related art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM). The instructions include a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, or a network device, etc.) to perform the methods described in various embodiments of the present application.
根据本申请实施例的另一方面,还提供了一种用于实施上述虚拟现实场景的交互方法的虚拟现实场景的交互装置。如图8所示,该装置可以包括:According to another aspect of the embodiments of the present application, an interaction apparatus for implementing a virtual reality scenario of the interaction method of the virtual reality scenario described above is further provided. As shown in FIG. 8, the apparatus may include:
1)确定单元802,设置为在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,虚拟现实场景中显示有射线;1) a determining unit 802, configured to determine, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, wherein the ray is displayed in the virtual reality scene;
2)检测单元804,设置为在初始目标对象中检测出与射线发生碰撞的最终目标对象;2) a detecting unit 804 configured to detect a final target object colliding with the ray in the initial target object;
3)操作单元806,设置为对最终目标对象中射线所选中的控件进行操作。3) An operation unit 806, configured to operate on the control selected by the ray in the final target object.
可选地,在本实施例中,上述虚拟现实场景的交互装置可以但不限于应用于使用虚拟现实设备进行虚拟现实交互应用的过程中,例如,上述虚拟现实交互应用可以包括但不限于虚拟现实游戏、虚拟现实影视播放、虚拟现实购物等等。上述仅是一种示例,本实施例中对此不做任何限定。其中,该虚拟现实设备可以包括但不限于VR眼镜。进一步,上述交互过程可以但不限于与虚拟现实场景中的平面中的对象进行交互,例如,如图3所示,虚线方框内所示为VR眼镜(虚拟现实场景交互的设备102)中所显示的虚拟现实场景内容:在二维平面内显示有待交互的对象A至对象E,其中,与射线发生碰撞的最终目标对象为对象E;此外,在本实施例中,上述交互过程也可以但不限于与虚拟现实场景中的三维角色对象进行交互,例如,如图4所示,虚线方框内所示为VR眼镜(虚拟现实场景交互的设备102)中所显示的虚拟现实场景内容:在三维空间内显示有待交互 的对象P、对象X、对象Y及对象Z,其中,与射线发生碰撞的最终目标对象为对象Y。上述仅是一种示例,本实施例中对此不做任何限定。Optionally, in this embodiment, the interaction device of the virtual reality scenario may be, but is not limited to, being applied to a virtual reality interactive application using a virtual reality device. For example, the virtual reality interaction application may include, but is not limited to, virtual reality. Games, virtual reality video playback, virtual reality shopping, and more. The above is only an example, and is not limited in this embodiment. The virtual reality device may include, but is not limited to, VR glasses. Further, the above interaction process may be, but is not limited to, interacting with objects in a plane in a virtual reality scene, for example, as shown in FIG. 3, which is shown in the dotted line box as VR glasses (device 102 for virtual reality scene interaction). Displaying the virtual reality scene content: displaying the object A to the object E to be interacted in the two-dimensional plane, wherein the final target object colliding with the ray is the object E; further, in the embodiment, the interaction process may be It is not limited to interacting with a three-dimensional character object in a virtual reality scene. For example, as shown in FIG. 4, the virtual reality scene content displayed in the VR glasses (the device 102 of the virtual reality scene interaction) is shown in the dotted line box: The object P to be interacted, the object X, the object Y, and the object Z are displayed in the three-dimensional space, wherein the final target object colliding with the ray is the object Y. The above is only an example, and is not limited in this embodiment.
需要说明的是,在本实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。进一步,通过射线碰撞检测实现与虚拟现实场景中的对象进行交互,还简化了交互操作,而无需使用鼠标等硬件设备进行复杂的交互运算,进而达到在保证交互准确性的情况下,提高交互效率的效果。It should be noted that, in this embodiment, after the initial target object that is allowed to collide with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and then in the initial target object. A final target object that collides with the ray is detected, and the control selected in the ray of the final target object is operated. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene. Further, the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.
此外,在本实施例中,上述碰撞检测(也称作碰撞侦测(Collision detection)),通常是指一种判断两个或多个对象是否产生交集的方法。可以应用于电子游戏和其他计算物理学中,也可以应用于人工智能中。除了可以用于确定两个对象是否已经碰撞,还可以用于计算冲击的时间(TOI),以及获取对象交叉碰撞的位置。Further, in the present embodiment, the above collision detection (also referred to as collision detection) generally refers to a method of determining whether two or more objects generate an intersection. It can be applied to video games and other computational physics, as well as to artificial intelligence. In addition to being used to determine if two objects have collided, it can also be used to calculate the time of impact (TOI) and to obtain the location of the object's cross collision.
可选地,在本实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象包括:根据对象的对象类型确定出与射线的射线类型具有对应关系的目标对象类型,以将目标对象类型的对象确定为允许与射线发生碰撞的初始目标对象。从而实现利用射线类型及对象类型之间的映射关系,确定出允许与射线发生碰撞的初始目标对象,以避免虚拟现实场景中与射线无关的对象参与交互判断过程,减少判断时间,进而达到简化交互判断步骤的效果。Optionally, in this embodiment, determining, in the object displayed in the virtual reality scene, the initial target object that is allowed to collide with the ray comprises: determining, according to the object type of the object, a target object having a corresponding relationship with the ray type of the ray Type to determine the object of the target object type as the initial target object that is allowed to collide with the ray. Thereby, the mapping relationship between the ray type and the object type is used to determine the initial target object that is allowed to collide with the ray, so as to avoid the ray-independent object participating in the interactive judgment process in the virtual reality scene, reducing the judgment time, thereby achieving simplified interaction. Determine the effect of the step.
可选地,在本实施例中,在初始目标对象中检测出与射线发生碰撞的最终目标对象包括:遍历每个初始目标对象,检测每个初始目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;将存在与射线重合 的部分的初始目标对象确定为最终目标对象。Optionally, in the embodiment, detecting the final target object that collides with the ray in the initial target object includes: traversing each initial target object, and detecting whether the space occupied by each initial target object in the virtual reality scene is There is a portion that coincides with the ray; an initial target object having a portion that coincides with the ray is determined as the final target object.
需要说明的是,在本实施例中,上述射线可以但不限于为具有起始点和终点的向量,上述检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分可以但不限于:检测上述空间中是否包含上述射线构成的向量中的点。也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线碰撞的最终目标对象的效果。此外,若虚拟现实场景所显示的多帧画面,则在本实施例中,可以但不限于对每一帧都做碰撞检测,以确定虚拟现实场景中所占的空间中是否包含上述射线构成的向量中的点,从而保证碰撞检测的精确度。It should be noted that, in this embodiment, the ray may be, but is not limited to, a vector having a start point and an end point. The foregoing detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may but not It is limited to: detecting whether or not the point in the vector formed by the above-mentioned rays is included in the space. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray. In addition, if the multi-frame picture is displayed in the virtual reality scene, in the embodiment, the collision detection may be performed for each frame to determine whether the space occupied by the virtual reality scene includes the above-mentioned rays. Points in the vector to ensure the accuracy of collision detection.
可选地,在本实施例中,利用射线所进行的操作可以包括但不限于:点击操作、移动操作、选中操作等等。与上述操作对应的执行事件可以包括但不限于以下至少之一:Optionally, in the embodiment, the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like. The execution event corresponding to the above operation may include, but is not limited to, at least one of the following:
1)进入事件(Enter):射线开始指向某一个对象,通过比较这一帧和上一帧的射线的击中对象列表的变化,看是否存在新添加的对象,触发新添加对象的事件;1) Enter event (Enter): The ray starts to point to an object, and compares the change of the hit object list of the ray of the previous frame and the previous frame to see if there is a newly added object, triggering the event of the newly added object;
2)离开事件(Leave):射线离开指向某一个对象,通过比较这一帧和上一帧的射线的击中对象列表的变化,看是否存在新删除的对象,触发新删除对象的事件;2) Leave event: The ray leaves to point to an object, and compares the change of the hit list of the ray of the previous frame and the previous frame to see if there is a newly deleted object, triggering the event of the newly deleted object;
3)按下事件(TouchDown):射线指向控件,按下交互按键的时候,触发交互列表中所有对象的事件;3) Pressing the event (TouchDown): the ray pointing control, when pressing the interactive button, triggers the event of all objects in the interaction list;
4)抬起事件(TouchUp):射线指向控件,抬起交互按键的时候,触发交互列表中所有对象的事件;4) LiftUp: The ray pointing control, when the interactive button is raised, triggers the events of all objects in the interaction list;
5)移动事件(Move):射线在最终目标对象中的各个控件上移动,触发交互列表中所有对象的事件。5) Move: The ray moves on each control in the final target object, triggering events for all objects in the interaction list.
6)其他:对于一些特殊的事件,比如拖动操作触发的拖动事件等等。6) Other: For some special events, such as drag events triggered by drag operations, and so on.
需要说明的是,上述控件可以但不限于为用于构成界面的一系列预先制作的功能控件,例如,按钮,复选框,滑块,进度条等。上述仅是一种示例,本实施例中对此不做任何限定。It should be noted that the above controls may be, but are not limited to, a series of pre-made functional controls for constructing an interface, such as buttons, check boxes, sliders, progress bars, and the like. The above is only an example, and is not limited in this embodiment.
通过本申请提供的实施例,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。With the embodiment provided by the present application, after the initial target object that allows the collision with the ray is determined in the object displayed in the virtual reality scene, the ray is displayed in the virtual reality scene, and then detected in the initial target object. The final target object in which the ray collides, operating on the ray-selected controls in the final target object. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene.
作为一种可选的方案,确定单元802包括:As an alternative, the determining unit 802 includes:
1)获取模块,设置为获取对象的对象类型;1) Get the module, set to get the object type of the object;
2)第一确定模块,设置为在对象类型中确定出与射线的射线类型具有对应关系的目标对象类型;2) a first determining module, configured to determine, in the object type, a target object type having a corresponding relationship with a ray type of the ray;
3)第二确定模块,设置为在对象中将类型为目标对象类型的对象确定为初始目标对象。3) The second determining module is configured to determine an object of the type of the target object type as an initial target object in the object.
可选地,在本实施例中,对允许与射线发生碰撞的对象的类型设置为目标对象类型,用object collision对象表示,将用于碰撞检测的射线类型用laser collision对象表示。上述仅是一种示例,本实施例中对此不做任何限定。Alternatively, in the present embodiment, the type of the object that allows collision with the ray is set as the target object type, represented by the object collision object, and the type of the ray for collision detection is represented by a laser collision object. The above is only an example, and is not limited in this embodiment.
需要说明的是,在本实施例中,上述用于进行射线碰撞检测的碰撞方式可以但不限于使用相关技术中的碰撞包围盒,通过将被检测的个体用碰撞包围盒包围,检测各个碰撞包围盒是否有交叉,对于产生交叉的情况,检测出为产生碰撞。上述仅是一种示例,本实施例中对碰撞检测的方式不做限定,还可以采用其他碰撞检测方式。It should be noted that, in the embodiment, the collision mode for performing the ray collision detection may be, but not limited to, using the collision bounding box in the related art, and detecting the collision surrounding by surrounding the detected individual with the collision bounding box. Whether the box has an intersection, and in the case of an intersection, it is detected as a collision. The foregoing is only an example. In this embodiment, the manner of collision detection is not limited, and other collision detection methods may also be adopted.
通过本申请提供的实施例,通过对虚拟现实场景中的对象按类型进行 分类,以实现对与射线类型具有对应关系的目标对象类型进行碰撞检测,从而实现对于不是目标对象类型的对象直接略过检测,达到射线减少碰撞检测的对象的数量,实现大大节约碰撞检测的时间消耗的效果,进而达到简化交互判断步骤的效果。Through the embodiment provided by the present application, by classifying the objects in the virtual reality scene by type, collision detection is performed on the target object type corresponding to the ray type, thereby directly skipping the object that is not the target object type. The detection reaches the number of objects that reduce the collision detection by the ray, and the effect of greatly reducing the time consumption of the collision detection is realized, thereby achieving the effect of simplifying the interactive judgment step.
作为一种可选的方案,检测单元804包括:As an alternative, the detecting unit 804 includes:
1)处理模块,设置为对初始目标对象中的每个对象执行以下步骤,其中,初始目标对象在执行以下步骤时被视为当前目标对象:1) A processing module, configured to perform the following steps on each object in the initial target object, wherein the initial target object is treated as the current target object when performing the following steps:
S1,检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;S1, detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray;
S2,若空间存在与射线重合的部分,则将当前目标对象确定为最终目标对象。S2, if the space has a portion that coincides with the ray, the current target object is determined as the final target object.
可选地,在本实施例中,可以但不限于对确定为目标对象类型的初始目标对象执行遍历判断过程,其中,分别将每个初始目标对象作为当前目标对象:检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;将存在与射线重合的部分的初始目标对象确定为最终目标对象。Optionally, in this embodiment, the traversal determination process may be performed on the initial target object determined to be the target object type, where each initial target object is respectively used as the current target object: detecting the current target object in the virtual reality Whether the space occupied by the scene has a portion coincident with the ray; the initial target object of the portion where the ray coincides is determined as the final target object.
需要说明的是,在本实施例中,上述射线可以但不限于为具有起始点和终点的向量。在本实施例中,上述检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分可以但不限于:检测上述空间中是否包含上述射线构成的向量中的点。也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线碰撞的最终目标对象的效果。其中,上述当前目标对象在虚拟现实场景中所占的空间可以但不限于如图3所示,以对象E为例,对象E在虚拟现实场景中所占的空间为一个矩形平面区域;如图4所示,以对象Y为例,对象Y在虚拟现实场景中所占的空间为一个人物角色Y在三维空间中所占用的立体空间。It should be noted that, in this embodiment, the ray may be, but is not limited to, a vector having a starting point and an ending point. In this embodiment, the detecting whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray may be, but is not limited to, detecting whether the space includes a point in the vector formed by the ray. That is to say, the space occupied by the virtual reality scene and each point position on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray. The space occupied by the current target object in the virtual reality scene may be, but is not limited to, as shown in FIG. 3 . Taking the object E as an example, the space occupied by the object E in the virtual reality scene is a rectangular plane area; As shown in FIG. 4, taking the object Y as an example, the space occupied by the object Y in the virtual reality scene is a three-dimensional space occupied by the character character Y in the three-dimensional space.
具体结合以下示例进行说明,例如,以图3所示对象E为例,若检测出射线与对象E对应的矩形平面区域存在交叉,则可检测出对象E存在与射线重合的部分,可将对象E确定为最终目标对象。又例如,以图4所示对象Y为例,若检测出射线与对象Y对应的人物角色Y所占的立体空间存在交叉,则可检测出对象Y存在与射线重合的部分,可将对象Y确定为最终目标对象。Specifically, the following example is used. For example, taking the object E shown in FIG. 3 as an example, if it is detected that there is a cross between the rectangular plane regions corresponding to the object E, it is possible to detect that the object E has a portion overlapping with the ray, and the object can be detected. E is determined as the final target object. For example, taking the object Y shown in FIG. 4 as an example, if it is detected that the three-dimensional space occupied by the persona Y corresponding to the object Y intersects, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be detected. Determined as the final target object.
通过本申请提供的实施例,通过遍历各个初始目标对象,分别依次判断各个初始目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分,以实现根据判断结果准确检测出用于交互的最终目标对象,保证交互的准确性。Through the embodiment provided by the present application, by traversing each initial target object, it is sequentially determined whether the space occupied by each initial target object in the virtual reality scene has a portion overlapping with the ray, so as to accurately detect the interaction for the interaction according to the determination result. The ultimate target object ensures the accuracy of the interaction.
作为一种可选的方案,处理模块通过以下步骤实现检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分:As an optional solution, the processing module implements the following steps to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray:
S1,检测空间是否包含射线上的点,其中,射线包括:起始点和终点,射线的方向由起始点指向终点;S1, detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
S2,若检测出空间包含射线上的点,则确定出空间存在与射线重合的部分。S2, if it is detected that the space includes a point on the ray, it is determined that there is a portion where the space overlaps with the ray.
可选地,在本实施例中,上述射线可以但不限于为包括起始点和终点的有向向量。其中,上述起始点可以但不限于为在虚拟现实场景中发出射线的位置,终点是按照射线所指方向延伸一定距离后到达的位置,在这条射线上的每一个位置都需要进行碰撞检测。Optionally, in the embodiment, the ray may be, but is not limited to, a directional vector including a starting point and an ending point. Wherein, the starting point may be, but not limited to, a position where a ray is emitted in a virtual reality scene, and an end point is a position that arrives after extending a certain distance according to a direction indicated by the ray, and collision detection is required at each position on the ray.
例如,如图5所示,假设起始点以手指在虚拟现实场景中的位置(如用Hand Position表示)为例,根据提前设置好的射线的延伸距离(如用Max Distance表示),获取对应的终点(如用Max Range Position表示),按照手指方向检测对象Y所占空间是否包括上述射线上的点。例如,如图6所示,碰撞检测结果表示:对象Y对应的人物角色Y所占的立体空间与上述射线(起始点为Hand Position,终点为Max Range Position)存在交 叉,交叉点为图6所示位置,则可检测出对象Y存在与射线重合的部分,可将对象Y确定为最终目标对象。For example, as shown in FIG. 5, assuming that the starting point takes the position of the finger in the virtual reality scene (as indicated by Hand Position) as an example, according to the extended distance of the ray set in advance (as indicated by Max Distance), the corresponding point is obtained. The end point (as indicated by the Max Range Position) detects whether the space occupied by the object Y includes the point on the above-mentioned ray according to the direction of the finger. For example, as shown in FIG. 6 , the collision detection result indicates that the stereoscopic space occupied by the persona Y corresponding to the object Y intersects with the ray (the starting point is the Hand Position and the end point is the Max Range Position), and the intersection point is as shown in FIG. 6 . When the position is displayed, it is possible to detect that the object Y has a portion overlapping with the ray, and the object Y can be determined as the final target object.
可选地,在本实施例中,处理模块通过以下步骤通过以下步骤确定终点:根据起始点在虚拟现实场景中的位置、用于指示方向的方向矢量、预定确定的距离范围值,确定出终点在虚拟现实场景中的位置。Optionally, in this embodiment, the processing module determines the end point by determining the end point according to the position of the starting point in the virtual reality scene, the direction vector for indicating the direction, and the predetermined determined distance range value. The location in the virtual reality scene.
例如,如图7所示,用于确定上述射线的终点的公式如下:For example, as shown in FIG. 7, the formula for determining the end point of the above ray is as follows:
Max Range Position=Hand Position+Hand Forward Vector*Max DistanceMax Range Position=Hand Position+Hand Forward Vector*Max Distance
其中,上述Hand Forward Vector用于表示射线方向的单位向量。也就是说在起始点的三维坐标上,叠加沿射线方向上的延伸距离的三维坐标,从而得到终点的三维坐标。Wherein, the above Hand Forward Vector is used to represent a unit vector of a ray direction. That is to say, on the three-dimensional coordinates of the starting point, the three-dimensional coordinates of the extending distance in the ray direction are superimposed, thereby obtaining the three-dimensional coordinates of the end point.
通过本申请提供的实施例,通过检测空间是否包含射线上的点,以实现检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分,也就是说,将虚拟现实场景中所占的空间与射线上的每个点位置分别进行碰撞检测,以达到准确判断出与射线碰撞的最终目标对象的效果,从而保证碰撞检测的精确度,进而实现提高交互准确性的效果。Through the embodiment provided by the present application, by detecting whether the space includes a point on the ray, it is possible to detect whether the space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray, that is, in the virtual reality scene. The space occupied and the position of each point on the ray are respectively detected by collision, so as to accurately determine the effect of the final target object colliding with the ray, thereby ensuring the accuracy of the collision detection, thereby achieving the effect of improving the interaction accuracy.
作为一种可选的方案,操作单元806包括:As an alternative, the operating unit 806 includes:
1)选中模块,设置为在最终目标对象中选中射线与最终目标对象重合的位置上的控件;1) Select the module, set to control the position where the ray coincides with the final target object in the final target object;
2)操作模块,设置为对控件进行操作。2) The operation module is set to operate on the control.
可选地,在本实施例中,操作模块包括:Optionally, in this embodiment, the operation module includes:
(1)第一确定子模块,设置为在检测到与虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;(1) a first determining submodule configured to determine that a start click event is detected when detecting that an interactive button corresponding to the virtual reality scene is pressed;
(2)第二确定子模块,设置为在检测到与虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;(2) a second determining submodule configured to determine that an end click event is detected when detecting that the interactive button corresponding to the virtual reality scene is raised;
(3)第三确定子模块,设置为在检测到开始点击事件和结束点击事件时,对控件进行点击操作。(3) The third determining sub-module is configured to perform a click operation on the control when the start click event and the end click event are detected.
可选地,在本实施例中,上述虚拟现实场景中对象可以包括但不限于:虚幻动态图形(Unreal Mobile)UI设计器所设计的对象(称作UMG对象),目标对象类型中的对象。Optionally, in this embodiment, the objects in the virtual reality scene may include, but are not limited to, an object designed by an Unreal Mobile UI designer (referred to as a UMG object), and an object in the target object type.
需要说明的是,在本实施例中,如果与射线发生碰撞的是UMG对象,则需调用UMG相关的控制逻辑,例如,在UE4环境中,对于UMG对象,通过调用Widget的On系列函数来触发widget的事件响应,从而达到兼容一般的游戏引擎对于UMG的支持的目的。也就是说,虚拟现实内容开发者可以采用一般UI的制作方法来为虚拟现实场景制作用户界面(User Interface,简称UI)菜单,该菜单可以直接应用于虚拟现实场景进行交互。此外,在本实施例中,如果与射线发生碰撞的不是UMG对象,而是目标对象类型中的对象,则可参照本实施例中记载的交互方式进行交互。It should be noted that, in this embodiment, if a UMG object collides with the ray, the UMG-related control logic needs to be called. For example, in the UE4 environment, for the UMG object, the Widget's On series function is used to trigger. The widget's event response is to achieve compatibility with the general game engine for UMG support. That is to say, the virtual reality content developer can use the general UI production method to create a user interface (UI) menu for the virtual reality scene, and the menu can be directly applied to the virtual reality scene for interaction. Further, in the present embodiment, if the UPG object is collided with the ray, but the object in the target object type, the interaction can be performed with reference to the interactive mode described in the embodiment.
可选地,在本实施例中,利用射线所进行的操作可以包括但不限于:点击操作、移动操作、选中操作等等。上述仅是一种示例,本实施例中对此不做任何限定。例如,以点击操作为例,可以但不限于通过以下事件确定:Optionally, in the embodiment, the operations performed by using the ray may include, but are not limited to, a click operation, a move operation, a selection operation, and the like. The above is only an example, and is not limited in this embodiment. For example, taking a click operation as an example can be, but is not limited to, determined by the following events:
1)按下事件(TouchDown):射线指向控件,按下交互按键的时候,触发交互列表中所有对象的事件。对于UMG直接调用widget已经存在的On系列函数触发已经存在的回调机制,对于其他则自定义该事件的回调函数;1) PressDown: The ray points to the control. When the interactive button is pressed, the events of all objects in the interactive list are triggered. For the UMG directly call the Widget already exists, the On series function triggers the existing callback mechanism, and for others, customizes the callback function of the event;
2)抬起事件(TouchUp):射线指向控件,抬起交互按键的时候,触发交互列表中所有对象的事件。对于UMG直接调用widget已经存在的On系列函数触发已经存在的回调机制,对于其他则自定义该事件的回调函数。2) LiftUp: The ray pointing control, when the interactive button is raised, triggers the events of all objects in the interaction list. For the UMG directly call the Widget already exists, the On series function triggers the existing callback mechanism, and for others, customizes the callback function of the event.
也就是说,在检测到与虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;在检测到与虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;然后在检测到开始点击事件和结束点击事件时,确认对控件进行点击操作。That is, when it is detected that the interactive button corresponding to the virtual reality scene is pressed, it is determined that the start click event is detected; when it is detected that the interactive button corresponding to the virtual reality scene is raised, it is determined that the end click is detected Event; then confirm the click on the control when it detects the start click event and the end click event.
例如,以图5为例,在选中对象Y为最终目标对象时,选中射线与最终目标对象重合的位置(如对象Y的右脚),然后对重合的位置(如对象Y的右脚)上的控件执行点击操作,例如检测到交互按键被按下的开始点击事件及交互按键被抬起时的结束点击事件,则可确认对上述控件执行点击操作。从而实现对对象Y对应的人物角色Y的右脚的交互控制,例如通过点击右脚实现控制抬起右脚执行踢球动作。上述仅是一种示例,本实施例中对此不做任何限定。For example, in FIG. 5, when the selected object Y is the final target object, the position where the ray coincides with the final target object (such as the right foot of the object Y) is selected, and then the coincident position (such as the right foot of the object Y) is selected. The control performs a click operation, for example, detecting a start click event in which the interactive button is pressed and an end click event when the interactive button is raised, and then confirming that the click operation is performed on the above control. Thereby, the interactive control of the right foot of the character character Y corresponding to the object Y is realized, for example, by clicking the right foot to control the raising of the right foot to perform the kicking action. The above is only an example, and is not limited in this embodiment.
通过本申请提供的实施例,在最终目标对象中选中射线与最终目标对象重合的位置上的控件,对该控件进行操作。从而实现在虚拟现实场景中通过射线完成与对象之间的交互,以保证交互准确性。Through the embodiment provided by the present application, the control is operated by selecting a control at a position where the ray coincides with the final target object in the final target object. Thereby, the interaction between the object and the object is completed by the ray in the virtual reality scene to ensure the interaction accuracy.
此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例1所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。It should be noted here that the above modules are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above embodiment 1. It should be noted that the foregoing module may be implemented in a hardware environment as shown in FIG. 1 as part of the device, and may be implemented by software or by hardware, where the hardware environment includes a network environment.
根据本申请实施例的又一方面,还提供了一种电子装置,其中该电子装置包括:存储器和处理器,存储器中存储有计算机程序,处理器被设置为通过计算机程序执行上述的虚拟现实场景的交互方法。例如,电子装置可以为用于实施上述虚拟现实场景的交互方法的虚拟现实场景的交互终端,如图9所示,该终端包括:According to still another aspect of the embodiments of the present application, there is also provided an electronic device, wherein the electronic device comprises: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the virtual reality scene described above by using a computer program Interactive method. For example, the electronic device may be an interactive terminal of a virtual reality scenario for implementing the interaction method of the virtual reality scenario. As shown in FIG. 9, the terminal includes:
1)通讯接口902,设置为获取虚拟现实场景中所显示的射线;1) a communication interface 902, configured to acquire a ray displayed in a virtual reality scene;
2)处理器904,与通讯接口902连接,设置为在虚拟现实场景中显示 的对象中确定出允许与射线发生碰撞的初始目标对象,其中,虚拟现实场景中显示有射线;还设置为在初始目标对象中检测出与射线发生碰撞的最终目标对象;还设置为对最终目标对象中射线所选中的控件进行操作;2) The processor 904 is connected to the communication interface 902, and is configured to determine, in the object displayed in the virtual reality scene, an initial target object that allows collision with the ray, wherein the ray is displayed in the virtual reality scene; A final target object that collides with the ray is detected in the target object; and is also set to operate on the ray selected control in the final target object;
3)显示器906,与处理器904连接,设置为现实射线、初始目标对象及最终目标对象;3) a display 906, connected to the processor 904, configured as a real ray, an initial target object, and a final target object;
4)存储器908,与通讯接口902、处理器904及显示器906连接,设置为存储上述初始目标对象、最终目标对象,及射线位置信息。4) The memory 908 is connected to the communication interface 902, the processor 904, and the display 906, and is configured to store the initial target object, the final target object, and the ray position information.
可选地,本实施例中的具体示例可以参考上述实施例1和实施例2中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in Embodiment 1 and Embodiment 2, and details are not described herein again.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(Random Access Memory,RAM)、磁盘或光盘等。A person of ordinary skill in the art may understand that all or part of the steps of the foregoing embodiments may be completed by a program to instruct terminal device related hardware, and the program may be stored in a computer readable storage medium, and the storage medium may be Including: flash disk, read-only memory (ROM), random access memory (RAM), disk or optical disk.
可选地,本领域普通技术人员可以理解,图9所示的结构仅为示意,终端也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile Internet Devices,MID)、PAD等设备。图9其并不对上述终端的结构造成限定。例如,终端还可包括比图9中所示更多或者更少的组件(如网络接口等),或者具有与图9所示不同的配置。Optionally, those skilled in the art can understand that the structure shown in FIG. 9 is only illustrative, and the terminal may also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palmtop computer, and a mobile Internet device (Mobile Internet). Devices, MID), PAD and other equipment. Fig. 9 does not limit the structure of the above terminal. For example, the terminal may also include more or less components (such as a network interface, etc.) than shown in FIG. 9, or have a different configuration than that shown in FIG.
其中,存储器908可用于存储软件程序以及模块,如本发明实施例中的虚拟现实场景的交互方法和装置对应的程序指令/模块,处理器904通过运行存储在存储器908内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的虚拟现实场景的交互方法。存储器908可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器908 可进一步包括相对于处理器904远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 908 can be used to store software programs and modules, such as the interactive method of the virtual reality scene and the program instructions/modules corresponding to the device in the embodiment of the present invention. The processor 904 runs the software program and the module stored in the memory 908. Thereby performing various functional applications and data processing, that is, implementing the above-described interactive method of the virtual reality scene. Memory 908 can include high speed random access memory, and can also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, memory 908 can further include memory remotely located relative to processor 904, which can be connected to the terminal over a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
上述的通讯接口902用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,通讯接口902包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,通讯接口902为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。The communication interface 902 described above is for receiving or transmitting data via a network. Specific examples of the above network may include a wired network and a wireless network. In one example, communication interface 902 includes a Network Interface Controller (NIC) that can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network. In one example, the communication interface 902 is a Radio Frequency (RF) module for communicating with the Internet wirelessly.
其中,具体地,存储器908用于存储目标对象、射线类型与目标对象类型的对应关系等内容。Specifically, the memory 908 is configured to store content such as a target object, a correspondence relationship between a ray type and a target object type, and the like.
根据本申请的实施例的又一方面,还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。According to still another aspect of an embodiment of the present application, a storage medium is also provided. Optionally, in this embodiment, the foregoing storage medium may be located on at least one of the plurality of network devices in the network shown in the foregoing embodiment.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,虚拟现实场景中显示有射线;S1. Determine an initial target object that is allowed to collide with the ray in the object displayed in the virtual reality scene, where the ray is displayed in the virtual reality scene;
S2,在初始目标对象中检测出与射线发生碰撞的最终目标对象;S2, detecting a final target object that collides with the ray in the initial target object;
S3,对最终目标对象中射线所选中的控件进行操作。S3, operates on the control selected by the ray in the final target object.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,获取对象的对象类型;S1, obtaining an object type of the object;
S2,在对象类型中确定出与射线的射线类型具有对应关系的目标对象 类型;S2, determining, in the object type, a target object type corresponding to the ray type of the ray;
S3,在对象中将类型为目标对象类型的对象确定为初始目标对象。S3, determining an object of the type of the target object type as an initial target object in the object.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,对初始目标对象中的每个对象执行以下步骤,其中,初始目标对象在执行以下步骤时被视为当前目标对象;S1, performing the following steps on each object in the initial target object, wherein the initial target object is regarded as the current target object when performing the following steps;
S2,检测当前目标对象在虚拟现实场景中所占的空间是否存在与射线重合的部分;S2, detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping with the ray;
S3,若空间存在与射线重合的部分,则将当前目标对象确定为最终目标对象。S3. If the space has a portion that coincides with the ray, the current target object is determined as the final target object.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,检测空间是否包含射线上的点,其中,射线包括:起始点和终点,射线的方向由起始点指向终点;S1, detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and the direction of the ray is directed from the starting point to the end point;
S2,若检测出空间包含射线上的点,则确定出空间存在与射线重合的部分。S2, if it is detected that the space includes a point on the ray, it is determined that there is a portion where the space overlaps with the ray.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,根据起始点在虚拟现实场景中的位置、用于指示方向的方向矢量、预定确定的距离范围值,确定出终点在虚拟现实场景中的位置。S1. Determine a position of the end point in the virtual reality scene according to the position of the starting point in the virtual reality scene, the direction vector for indicating the direction, and the predetermined determined distance range value.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,在最终目标对象中选中射线与最终目标对象重合的位置上的控件;S1, in the final target object, select a control at a position where the ray coincides with the final target object;
S2,对控件进行操作。S2, operate on the control.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的计算机程序:Optionally, in the present embodiment, the storage medium is arranged to store a computer program for performing the following steps:
S1,在检测到与虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;S1. When detecting that the interactive button corresponding to the virtual reality scene is pressed, determining that the start click event is detected;
S2,在检测到与虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;S2. When detecting that the interactive button corresponding to the virtual reality scene is raised, determining that the end click event is detected;
S3,在检测到开始点击事件和结束点击事件时,对控件进行点击操作。S3, when the start click event and the end click event are detected, the control is clicked.
可选地,本实施例中的具体示例可以参考上述实施例1和实施例2中所描述的示例,本实施例在此不再赘述。For example, the specific examples in this embodiment may refer to the examples described in Embodiment 1 and Embodiment 2, and details are not described herein again.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储计算机程序的介质。Optionally, in this embodiment, the foregoing storage medium may include, but not limited to, a USB flash drive, a Read-Only Memory (ROM), a Random Access Memory (RAM), a mobile hard disk, and a magnetic memory. A variety of media that can store computer programs, such as a disc or an optical disc.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对相关技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。The integrated unit in the above embodiment, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in the above-described computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, or the whole or part of the technical solution, which is stored in the storage medium, including The instructions are used to cause one or more computer devices (which may be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present application, the descriptions of the various embodiments are different, and the parts that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的, 例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The device embodiments described above are only schematic. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or may be Integrate into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, unit or module, and may be electrical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
以上所述仅是本申请的可选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above description is only an alternative embodiment of the present application, and it should be noted that those skilled in the art can make several improvements and retouchings without departing from the principles of the present application. It should also be considered as the scope of protection of this application.
工业实用性Industrial applicability
在本申请实施例中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象后,其中,虚拟现实场景中显示有射线,再在上述初始目标对象中检测出与射线发生碰撞的最终目标对象,对最终目标对象中射线所选中的控件进行操作。从而实现通过射线碰撞检测从初始目标对象中,获取在虚拟现实场景中所要交互的最终目标对象,以达到对射线所选中的最终目标对象中的控件进行操作的目的,进而克服相关技术中无法对虚拟现实场景中的对象进行精准交互的问题。进一步,通过射线碰撞检测实现与虚拟现实场景中的对象进行交互,还简化了交互操作,而无需使用鼠标等硬件设备进行复杂的交互运算,进而达到在保证交互准确性 的情况下,提高交互效率的效果。In the embodiment of the present application, after the initial target object that allows collision with the ray is determined in the object displayed in the virtual reality scene, wherein the ray is displayed in the virtual reality scene, and the ray is detected in the initial target object. The final target object in which the collision occurred, operates on the control selected by the ray in the final target object. Thereby, the final target object to be interacted in the virtual reality scene is acquired from the initial target object by the ray collision detection, so as to achieve the purpose of operating the control in the final target object in the ray selection, thereby overcoming the related technology. The problem of precise interaction of objects in a virtual reality scene. Further, the ray collision detection realizes interaction with objects in the virtual reality scene, and simplifies the interaction operation, without using a hardware device such as a mouse to perform complex interaction operations, thereby improving the interaction efficiency while ensuring the accuracy of the interaction. Effect.

Claims (16)

  1. 一种虚拟现实场景的交互方法,包括:A method for interacting with a virtual reality scene includes:
    在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,所述虚拟现实场景中显示有所述射线;Determining, in an object displayed in the virtual reality scene, an initial target object that allows collision with the ray, wherein the ray is displayed in the virtual reality scene;
    在所述初始目标对象中检测出与所述射线发生碰撞的最终目标对象;Detecting a final target object colliding with the ray in the initial target object;
    对所述最终目标对象中所述射线所选中的控件进行操作。Manipulating the control selected in the ray in the final target object.
  2. 根据权利要求1所述的方法,其中,在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象包括:The method of claim 1, wherein determining, in the object displayed in the virtual reality scene, an initial target object that allows collision with the ray comprises:
    获取所述对象的对象类型;Get the object type of the object;
    在所述对象类型中确定出与所述射线的射线类型具有对应关系的目标对象类型;Determining, in the object type, a target object type having a corresponding relationship with a ray type of the ray;
    在所述对象中将类型为所述目标对象类型的对象确定为所述初始目标对象。An object of the type of the target object type is determined as the initial target object in the object.
  3. 根据权利要求1所述的方法,其中,在所述初始目标对象中检测出与所述射线发生碰撞的最终目标对象包括:The method of claim 1, wherein detecting a final target object colliding with the ray in the initial target object comprises:
    对所述初始目标对象中的每个对象执行以下步骤,其中,所述初始目标对象在执行以下步骤时被视为当前目标对象:Performing the following steps on each of the initial target objects, wherein the initial target object is considered to be the current target object when performing the following steps:
    检测所述当前目标对象在所述虚拟现实场景中所占的空间是否存在与所述射线重合的部分;Detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping the ray;
    若所述空间存在与所述射线重合的部分,则将所述当前目标对象确定为所述最终目标对象。If the space has a portion that coincides with the ray, the current target object is determined as the final target object.
  4. 根据权利要求3所述的方法,其中,检测所述当前目标对象在所述虚拟现实场景中所占的空间是否存在与所述射线重合的部分包括:The method according to claim 3, wherein detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping the ray comprises:
    检测所述空间是否包含所述射线上的点,其中,所述射线包括:起始点和终点,所述射线的方向由所述起始点指向所述终点;Detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and a direction of the ray is directed from the starting point to the end point;
    若检测出所述空间包含所述射线上的点,则确定出所述空间存在与所述射线重合的部分。If it is detected that the space contains a point on the ray, it is determined that the space has a portion that coincides with the ray.
  5. 根据权利要求4所述的方法,其中,通过以下步骤确定所述终点:The method of claim 4 wherein said endpoint is determined by the following steps:
    根据所述起始点在所述虚拟现实场景中的位置、用于指示所述方向的方向矢量、预定确定的距离范围值,确定出所述终点在所述虚拟现实场景中的位置。Determining a position of the end point in the virtual reality scene according to a location of the starting point in the virtual reality scene, a direction vector indicating the direction, and a predetermined determined distance range value.
  6. 根据权利要求1至5中任一项所述的方法,其中,对所述最终目标对象中所述射线所选中的控件进行操作包括:The method according to any one of claims 1 to 5, wherein operating the control selected in the ray in the final target object comprises:
    在所述最终目标对象中选中所述射线与所述最终目标对象重合的位置上的控件;Selecting, in the final target object, a control at a position where the ray coincides with the final target object;
    对所述控件进行操作。Operate on the control.
  7. 根据权利要求6所述的方法,其中,对所述控件进行操作包括:The method of claim 6 wherein operating the control comprises:
    在检测到与所述虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;When it is detected that the interactive button corresponding to the virtual reality scene is pressed, it is determined that the start click event is detected;
    在检测到与所述虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;When it is detected that the interactive button corresponding to the virtual reality scene is raised, it is determined that the end click event is detected;
    在检测到所述开始点击事件和所述结束点击事件时,对所述控件进行点击操作。When the start click event and the end click event are detected, the control is clicked.
  8. 一种虚拟现实场景的交互装置,包括:An interactive device for a virtual reality scene includes:
    确定单元,设置为在虚拟现实场景中显示的对象中确定出允许与射线发生碰撞的初始目标对象,其中,所述虚拟现实场景中显示有所述射线;a determining unit configured to determine, in an object displayed in the virtual reality scene, an initial target object that is allowed to collide with the ray, wherein the ray is displayed in the virtual reality scene;
    检测单元,设置为在所述初始目标对象中检测出与所述射线发生碰撞的最终目标对象;a detecting unit configured to detect, in the initial target object, a final target object that collides with the ray;
    操作单元,设置为对所述最终目标对象中所述射线所选中的控件进行操作。An operating unit configured to operate on a control selected by the ray in the final target object.
  9. 根据权利要求8所述的装置,其中,所述确定单元包括:The apparatus of claim 8 wherein said determining unit comprises:
    获取模块,设置为获取所述对象的对象类型;Obtaining a module, configured to obtain an object type of the object;
    第一确定模块,设置为在所述对象类型中确定出与所述射线的射线类型具有对应关系的目标对象类型;a first determining module, configured to determine, in the object type, a target object type that has a corresponding relationship with a ray type of the ray;
    第二确定模块,设置为在所述对象中将类型为所述目标对象类型的对象确定为所述初始目标对象。And a second determining module configured to determine, in the object, an object of the type of the target object as the initial target object.
  10. 根据权利要求8所述的装置,其中,所述检测单元包括:The apparatus of claim 8 wherein said detecting unit comprises:
    处理模块,设置为对所述初始目标对象中的每个对象执行以下步骤,其中,所述初始目标对象在执行以下步骤时被视为当前目标对象:A processing module configured to perform the following steps on each of the initial target objects, wherein the initial target object is considered a current target object when performing the following steps:
    检测所述当前目标对象在所述虚拟现实场景中所占的空间是否存在与所述射线重合的部分;Detecting whether a space occupied by the current target object in the virtual reality scene has a portion overlapping the ray;
    若所述空间存在与所述射线重合的部分,则将所述当前目标对象确定为所述最终目标对象。If the space has a portion that coincides with the ray, the current target object is determined as the final target object.
  11. 根据权利要求10所述的装置,其中,所述处理模块通过以下步骤实现检测所述当前目标对象在所述虚拟现实场景中所占的空间是否存在与所述射线重合的部分:The apparatus according to claim 10, wherein the processing module detects whether a space occupied by the current target object in the virtual reality scene has a portion overlapping the ray by detecting:
    检测所述空间是否包含所述射线上的点,其中,所述射线包括:起始点和终点,所述射线的方向由所述起始点指向所述终点;Detecting whether the space contains a point on the ray, wherein the ray comprises: a starting point and an ending point, and a direction of the ray is directed from the starting point to the end point;
    若检测出所述空间包含所述射线上的点,则确定出所述空间存在与所述射线重合的部分。If it is detected that the space contains a point on the ray, it is determined that the space has a portion that coincides with the ray.
  12. 根据权利要求11所述的装置,其中,所述处理模块通过以下步骤通过以下步骤确定所述终点:The apparatus according to claim 11, wherein said processing module determines said end point by the following steps:
    根据所述起始点在所述虚拟现实场景中的位置、用于指示所述方向的方向矢量、预定确定的距离范围值,确定出所述终点在所述虚拟现实场景中的位置。Determining a position of the end point in the virtual reality scene according to a location of the starting point in the virtual reality scene, a direction vector indicating the direction, and a predetermined determined distance range value.
  13. 根据权利要求8至12中任一项所述的装置,其中,所述操作单元包 括:The apparatus according to any one of claims 8 to 12, wherein the operation unit comprises:
    选中模块,设置为在所述最终目标对象中选中所述射线与所述最终目标对象重合的位置上的控件;Selecting a module, configured to select, in the final target object, a control at a position where the ray coincides with the final target object;
    操作模块,设置为对所述控件进行操作。An operation module, configured to operate on the control.
  14. 根据权利要求13所述的装置,其中,所述操作模块包括:The apparatus of claim 13 wherein said operational module comprises:
    第一确定子模块,设置为在检测到与所述虚拟现实场景对应的交互按键被按下时,确定出检测到开始点击事件;a first determining submodule configured to determine that a start click event is detected when detecting that an interactive button corresponding to the virtual reality scene is pressed;
    第二确定子模块,设置为在检测到与所述虚拟现实场景对应的交互按键被抬起时,确定出检测到结束点击事件;a second determining submodule, configured to determine that an end click event is detected when detecting that the interactive button corresponding to the virtual reality scene is raised;
    第三确定子模块,设置为在检测到所述开始点击事件和所述结束点击事件时,对所述控件进行点击操作。The third determining submodule is configured to perform a click operation on the control when the start click event and the end click event are detected.
  15. 一种存储介质,所述存储介质中存储有计算机程序,其中,所述计算机程序被设置为运行时执行所述权利要求1至7任一项中所述的方法。A storage medium having stored therein a computer program, wherein the computer program is arranged to execute the method of any one of claims 1 to 7 at runtime.
  16. 一种电子装置,包括存储器和处理器,所述存储器中存储有计算机程序,所述处理器被设置为通过所述计算机程序执行所述权利要求1至7任一项中所述的方法。An electronic device comprising a memory and a processor, wherein the memory stores a computer program, the processor being arranged to perform the method of any one of claims 1 to 7 by the computer program.
PCT/CN2018/082512 2017-04-20 2018-04-10 Interaction method and apparatus for virtual reality scene, storage medium and electronic apparatus WO2018192394A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710263759.2A CN107145227B (en) 2017-04-20 2017-04-20 The exchange method and device of virtual reality scenario
CN201710263759.2 2017-04-20

Publications (1)

Publication Number Publication Date
WO2018192394A1 true WO2018192394A1 (en) 2018-10-25

Family

ID=59775036

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/082512 WO2018192394A1 (en) 2017-04-20 2018-04-10 Interaction method and apparatus for virtual reality scene, storage medium and electronic apparatus

Country Status (2)

Country Link
CN (1) CN107145227B (en)
WO (1) WO2018192394A1 (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145227B (en) * 2017-04-20 2019-01-08 腾讯科技(深圳)有限公司 The exchange method and device of virtual reality scenario
CN109725782B (en) * 2017-10-27 2021-08-24 腾讯科技(深圳)有限公司 Method and device for realizing virtual reality, intelligent equipment and storage medium
CN107704397B (en) * 2017-10-30 2020-10-09 歌尔科技有限公司 Application program testing method and device and electronic equipment
CN108052253B (en) * 2017-12-28 2020-09-25 灵图互动(武汉)科技有限公司 Virtual reality display content manufacturing method
CN108536288A (en) * 2018-03-27 2018-09-14 网易(杭州)网络有限公司 The treating method and apparatus of interactive operation in virtual reality
CN108762617A (en) * 2018-05-31 2018-11-06 苏州蜗牛数字科技股份有限公司 UI interactive systems, method and storage medium in a kind of VR environment
CN109407945B (en) * 2018-11-08 2021-08-27 山东数字人科技股份有限公司 Three-dimensional jigsaw realization method based on VR and three-dimensional jigsaw system
CN109782909B (en) * 2018-12-29 2020-10-30 北京诺亦腾科技有限公司 Interaction method and device for VR interaction equipment and VR scene
CN110032296B (en) * 2019-04-10 2022-06-03 网易(杭州)网络有限公司 Method and device for determining virtual object in terminal, terminal and storage medium
CN110262729B (en) * 2019-05-20 2021-11-16 联想(上海)信息技术有限公司 Object processing method and device
CN110990098A (en) * 2019-11-29 2020-04-10 北京新势界科技有限公司 Method and device for overlapping AR information points triggered by focus
CN110969687B (en) * 2019-11-29 2023-07-28 中国商用飞机有限责任公司北京民用飞机技术研究中心 Collision detection method, device, equipment and medium
CN111054066B (en) * 2019-12-17 2021-01-15 腾讯科技(深圳)有限公司 Operation method and device of virtual prop, storage medium and electronic device
CN111192354A (en) * 2020-01-02 2020-05-22 武汉瑞莱保能源技术有限公司 Three-dimensional simulation method and system based on virtual reality
CN111580669A (en) * 2020-05-12 2020-08-25 南京睿悦信息技术有限公司 Interaction method and device for virtual reality and augmented reality mobile end plane application
CN111569424B (en) * 2020-05-14 2023-04-28 北京代码乾坤科技有限公司 Physical settlement method and device in game scene
CN112107854B (en) * 2020-09-01 2021-03-16 苏州紫焰网络科技有限公司 Game task guide completion method, system and equipment
CN114578972B (en) * 2022-05-05 2022-07-26 江西科骏实业有限公司 Trigger method and system for compatible plane and curved surface UI (user interface) event in VR (virtual reality) scene

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101441542A (en) * 2008-11-21 2009-05-27 广东威创视讯科技股份有限公司 Method and apparatus for recognizing multiple target objects by interactive input apparatus
CN101770324A (en) * 2008-12-31 2010-07-07 商泰软件(上海)有限公司 Method for realizing interactive operation of 3D graphical interface
CN105892632A (en) * 2015-11-16 2016-08-24 乐视致新电子科技(天津)有限公司 Method and device for judging the selection of UI (User Interface) widgets of virtual reality application
CN106527887A (en) * 2016-10-18 2017-03-22 腾讯科技(深圳)有限公司 Virtual object selection method and apparatus, and VR system
CN107145227A (en) * 2017-04-20 2017-09-08 腾讯科技(深圳)有限公司 The exchange method and device of virtual reality scenario

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105913497B (en) * 2016-05-27 2018-09-07 杭州映墨科技有限公司 Virtual reality space movable positioning system for virtually seeing room and method
CN106445118B (en) * 2016-09-06 2019-05-17 网易(杭州)网络有限公司 Virtual reality exchange method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101441542A (en) * 2008-11-21 2009-05-27 广东威创视讯科技股份有限公司 Method and apparatus for recognizing multiple target objects by interactive input apparatus
CN101770324A (en) * 2008-12-31 2010-07-07 商泰软件(上海)有限公司 Method for realizing interactive operation of 3D graphical interface
CN105892632A (en) * 2015-11-16 2016-08-24 乐视致新电子科技(天津)有限公司 Method and device for judging the selection of UI (User Interface) widgets of virtual reality application
CN106527887A (en) * 2016-10-18 2017-03-22 腾讯科技(深圳)有限公司 Virtual object selection method and apparatus, and VR system
CN107145227A (en) * 2017-04-20 2017-09-08 腾讯科技(深圳)有限公司 The exchange method and device of virtual reality scenario

Also Published As

Publication number Publication date
CN107145227B (en) 2019-01-08
CN107145227A (en) 2017-09-08

Similar Documents

Publication Publication Date Title
WO2018192394A1 (en) Interaction method and apparatus for virtual reality scene, storage medium and electronic apparatus
KR102278822B1 (en) Implementation of virtual reality input
JP6529659B2 (en) Information processing method, terminal and computer storage medium
US10661171B2 (en) Information processing method, terminal, and computer storage medium
KR101842106B1 (en) Generating augmented reality content for unknown objects
JP7064607B2 (en) Information processing methods, devices, mobile terminals and storage media
US11809685B2 (en) Information interaction method and apparatus, storage medium, and electronic apparatus
CN108073280B (en) Selecting objects in an augmented or virtual reality environment
US8788973B2 (en) Three-dimensional gesture controlled avatar configuration interface
TW201814438A (en) Virtual reality scene-based input method and device
US20150185825A1 (en) Assigning a virtual user interface to a physical object
US9268410B2 (en) Image processing device, image processing method, and program
CN110292771B (en) Method, device, equipment and medium for controlling tactile feedback in game
WO2017092430A1 (en) Method and device for realizing user interface control based on virtual reality application
WO2019166005A1 (en) Smart terminal, sensing control method therefor, and apparatus having storage function
CN112370780A (en) Display method and device of virtual control, storage medium and electronic equipment
US10076704B2 (en) Game device
CN112150602A (en) Model image rendering method and device, storage medium and electronic equipment
JP2016018363A (en) Game program for display-controlling object arranged on virtual space plane
CN113827969A (en) Interaction method and device for game objects
WO2019080870A1 (en) Interaction interface display method and device, storage medium, and electronic device
CN116774835B (en) Interaction method, device and storage medium in virtual environment based on VR handle
WO2024037559A1 (en) Information interaction method and apparatus, and human-computer interaction method and apparatus, and electronic device and storage medium
WO2023066005A1 (en) Method and apparatus for constructing virtual scenario, and electronic device, medium and product
CN109753140B (en) Operation instruction obtaining method and device based on virtual reality

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18787459

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18787459

Country of ref document: EP

Kind code of ref document: A1