A method for clicking and selecting an object in a three-dimensional virtual reality scene, comprising:
- A1:
- receiving a positioning signal of a target object in a three-dimensional virtual reality scene;
- A2:
- projecting the target object to a set position in a display window according to the positioning signal;
- A3:
- if the target object is displayed at the set position, after a behavior for clicking the target object is perceived, acquiring two-dimensional coordinates corresponding to a clicking position in the display window;
- A4:
- determining a single object corresponding to the clicking position according to the two-dimensional coordinates;
- A5:
- acquiring a leaf node corresponding to the single object in a tree management structure, and acquiring a father node of the leaf node;
- A6:
- if the attribute of the father node is unlock, selecting the single object;
- A7:
- if the attribute of the father node is lock, tracing a node from the father node along a direction towards a root node of the tree management structure, wherein the node is closest to the father node and the attribute of the node as a father node is unlock, and selecting a combined object corresponding to the node in the three-dimensional virtual reality scene;
- the method further comprises:
- B1:
- if the target object is not displayed at the set position, judging whether the target object subordinates to a first object displayed at the set position in the three-dimensional virtual reality scene;
- B2:
- if the target object subordinates to the first object, after a behavior for clicking the first object is perceived, acquiring two-dimensional coordinates corresponding to a clicking position in the display window;
- B3:
- executing the Steps A4 to A7 so as to select the first object;
- B4:
- after a command for entering a next hierarchy is received, entering the next hierarchy of a first node corresponding to the first object, and configuring the attribute of the first node to be unlock;
- B5:
- judging whether a target node corresponding to the target object in the tree management structure is on the next hierarchy, if so, executing Step B7, otherwise, executing Step B6;
- B6:
- determining that the target object subordinates to a second object corresponding to a second node on the next hierarchy, setting the second object to be the first object, and executing the Step B2;
- B7:
- determining that the next hierarchy is a hierarchy where the target object is positioned;
- B8:
- if the target object is shaded by a third object on the hierarchy where the target object is positioned, after a behavior for clicking the third object is perceived, acquiring two-dimensional coordinates corresponding to a clicking position in the display window;
- B9:
- executing the Steps A4 to A7 so as to select the third object;
- B10:
- enhancing the transparency of the third object so as to display the target object and prohibit selecting the third object after the target object is displayed;
- B11:
- after a behavior for clicking the target object is perceived, acquiring two-dimensional coordinates corresponding to a clicking position in the display window;
- B12:
- executing the Steps A4 to A7 so as to select the target object;
- wherein a virtual node in the tree management structure has a configurable attribute, the configurable attribute is used for indicating whether to be lock, the virtual node is corresponding to the combined object;
- when an object on the current hierarchy is a combined object, a attribute of the virtual node corresponding to the object is lock;
- when entering the next hierarchy of the virtual node, the attribute of the virtual node is configured to be unlock;
- when backing to the previous hierarchy of the virtual node, the attribute of the virtual node is still lock, but the attribute of the father node of the virtual node is configured to be lock, and the father node is also a virtual node;
- wherein the two-dimensional coordinates corresponding to the clicking position are transmitted to a virtual camera corresponding to the window of the three-dimensional scene, and a ray perpendicular to the window of the three-dimensional scene is generated in a direction of the position of the camera, wherein the ray extends in the three-dimensional scene, and a single object which is intersected with the ray in the scene can be to detected.