Research On Bounding Volume Boxes Collision Detection Algorithm in Virtual Reality Technology
Research On Bounding Volume Boxes Collision Detection Algorithm in Virtual Reality Technology
Research On Bounding Volume Boxes Collision Detection Algorithm in Virtual Reality Technology
2nd International Conference on Sensor Network and Computer Engineering (ICSNCE 2018)
Abstract—This paper take the development of virtual campus authenticity, prevents the appearance of the characters
roaming system as an example. Aiming at the defects of the through the wall. The overlap of a part of a person and the
different kinds of bounding boxes collision detection object in a scene are obviously incompatible with the logic in
technology, analyzes the advantages of the hybrid hierarchical real life [3]. The basic principles can be defined as follows:
bounding box collision detection algorithm based on spheres In a virtual three-dimensional space with n objects. Its
and oriented bounding box, and described the way to construct three-dimensional geometric coordinate system and time
it. Finally, the algorithm is tested in the VC and Unity3d
variable constitute a four dimensional coordinate system,
engine, a good result is obtained.
which is represented as Cw . The path formed by the motion
Keywords-VR Technology; Bounding Volume Boxes; of the i -th object constitutes a subset of Cw . It marked as
Collision Detection; Unity3d Ci ( 1 ≤ i ≤ n ). Collision detection is to determine whether
the i1 -th object intersects the i 2 -th object, That is to
I. INTRODUCTION
determine whether Ci1 ! Ci 2 is empty.
Virtual reality (VR) is a comprehensive technology For the detection of object collision, Unity provides a
integrating computer graphics, multimedia technology and good test platform that you can create two virtual geometries
many other technologies. Its purpose is to simulate the scene in it, give them a collision device, and then detect the
in reality. As an open platform, it has three characteristics: collision effect between them. It is also possible to create
interactivity, conceptualization, and immersion [1]. In order two empty objects, add two specific colliders to them, test
to ensure the sense of the environment, the objects in the the collisions between different colliders directly, In addition
scene must have the corresponding physical properties. At you can create an object and a ray of light that simulates the
the same time, the user will not penetrate the object in impact of light cast on an object. These correspond to the
various operations, and can truly feel the occurrence of a three kinds of collision detection strategy in Unity, they
collision. So collision detection technology has a very called basic collision detection, trigger collision detection,
important position in the VR technology [2]. light projection [4].
Collision detection technology is developing
continuously, and some classic collision detection algorithms III. HYBRID HIERARCHICAL BOUNDING BOX BASED ON
are widely used. Such as AABB (Aligned Axis Bounding SURROUNDING AND DIRECTED BOUNDING BOXES
Box), Spheres, OBB (Oriented Bounding Box), etc. these
methods are applicable to objects with different geometric A. Bounding Box Technology
features, so their simplicity of detection is not ideal. Some There are many kinds of bounding boxes. Some classical
scholars have proposed a hybrid bounding box algorithm for methods include Spheres, AABB (Aligned Axis Bounding
the reason. An algorithm similar to OBB-Spheres is formed. Box), OBB (Oriented Bounding Box), etc [5]. This is the
In continuous collision detection, some scholars proposed a main introduction to Spheres and OBB.
subspace based algorithm, which effectively improved the 1) Spheres:
speed and accuracy of continuous collision detection. Bounding sphere (Spheres) is a relatively simple but poor
II. BASIC PRINCIPLE OF COLLISION DETECTION tightness bounding box. It will produce too much redundant
space for more concave objects as an outer sphere of the
The construction of virtual campus roaming system uses geometric object. So there is a phenomenon that the
collision detection technology, real-time rendering
collision occurs when the collision is not touched and the
technology, environment modeling technology, etc. The
collision detection technology ensures the true sense of the ball is encircled. In order to illustrate the construction
whole system, and constitutes the basis of the user process, it is assumed that the geometric object is E, The
experience, which gives the user a sense of immersion in the representation of all the most basic geometric elements
virtual scene. (such as triangles and circles) in the object with SE. The
Collision detection technology is to increase the impact calculation method of the encircling ball is simpler than that
body on the object in the scene, increase the sense of of the other bounding boxes: The average value of three sets
116
Advances in Computer Science Research, volume 79
objects onto the screen, and finally display them. As shown box algorithm has a better compact type, and the speed is
in Figure 1. faster when the object is displaced or rotated, But the
intersecting test is difficult, and the speed is slow. While the
Mapping Mapping encircling ball algorithm is poor in tightness, but the
intersection test is simple and fast, and it has faster update
speed than the OBB algorithm. In combination with the
advantages of the two algorithms, these two algorithms are
Texture Map Geometry Screen selected here.
The bounding ball algorithm can be used as the root
Figure 1. Texture Map. node of the bounding box tree because of the simple speed
of intersecting test. It can be used to eliminate a large
number of disjoint objects which are easily judged. There
C. Construction of Hierarchical Encircling Box Tree are two main methods used to construct encircling box trees.
The roaming system is a continuous cycle process that One bottom-up way is to form a basic geometric element of
draws every frame that is displayed to the user through an object as a leaf node, then recursively, and gradually
logical judgment, As shown in Figure 2. In order to improve form the final root node, another is the top - down method,
the speed and real-time performance of collision detection, which is completely the opposite, it recursive partition from
the traditional bounding box collision detection algorithm the root node, and finally to the leaf node. A top-down
can not get the desired result, and the hybrid bounding box method is used to construct a hierarchical encircling box
algorithm solves this problem [7]. tree here because of the maturity of the current construction
Start technology and the breadth of use, as shown in Figure 3.
Initialization
Loading scene
Mouse/Keyboard
No
Input?
Figure 3. The Top-down Bounding Box Tree .
Yes
It is considered whether it is built dynamically or in a
No static way when building a bounding box tree [8]. When the
Esc? End static structure is built, it is necessary to rebuild the
bounding box tree once the shape changes or moves.
Yes Otherwise, when the dynamic structure is used, it does not
need to be rebuilt with the change of the object. Although
Execution logic the dynamic structure is better than the static structure, it
needs to modify the node data in real time, and the stability
is weak. The real-time performance of the update is difficult
Picture update to solve. We use the static structure with high stability to
build the bounding box tree because the objects in the
Output buffer Memory virtual campus roaming system are mostly static objects,
they will not change when they collide.
Draw to the screen Monitor IV. SYSTEM APPLICATION AND TEST RESULTS
In order to verify that the algorithm can realize the
Figure 2. System Running Process collision detection between different geometric features well,
the initial test is carried out. A teapot and a cylinder are used
A hierarchical encircling box tree is a tree structure for a collision test. The teapot is made up of 8680 triangles
composed of tree nodes composed of encircling boxes. and 17500 vertices, and the cylinder is made up of 8064
According to the previous introduction, the OBB bounding triangles and 16256 vertices. Its complexity can meet the test
117
Advances in Computer Science Research, volume 79
requirements. A double encircling box is constructed on the TABLE I. TABLE COLLISION DETECTION TIME COMPARISON
vertex of two objects surrounded by two forked trees. The
outer layer of the node constructs the encircling ball, and the Overlap This paper’s RAPID algorithm efficiency
inner layer of the node constructs the OBB and the sphere number algorithm time- time-consuming/ms lifting
bounding box respectively. Compare it with the collision consuming/ms multiple
detection algorithm based on the OBB bounding box,
RAPID. According to the evaluation function of collision 31 6.73 13.13 1.95096
detection algorithm:
142 8.29 19.25 2.32207
T = N v × Cv + N p × C p + N u×Cu (4)
238 9.59 23.02 2.40042
The algorithm and the RAPID algorithm are compared and
analyzed. 347 11.21 23.89 2.13113
On the premise of obtaining the same and correct
detection results, the experiment compares the collision
429 12.19 28.86 2.36751
detection time between the two algorithms in the same
collision scene. According to the collision detection
evaluation function, when the two algorithms are used for 666 14.66 32.45 2.21351
collision detection, the number of basic geometric primitives
pairs involved (Np) is the same, and the cost of a pair of 815 18.87 45.78 2.42607
geometric primitives (Cp) is the same. The same scene is
used in the contrast experiment. The motion track of the 961 19.56 48.89 2.49949
object is the same. The number of nodes needed to be
updated by the two algorithms after the motion of the object
is the same as the number of Nu. This algorithm updates the 1081 22.89 54.21 2.36828
cost of a double bounding box (Cu), which is the cost of
updating an inner bounding box. Therefore, the total cost of 1295 25.96 62.03 2.38945
the two algorithms (T) is related to the cost Nv*Cv of the
bounding box overlap test and the cost Cu of updating a
bounding box.
The algorithm constructs sphere and OBB for the inner This paper’s algorithm
80
layer of the two forked tree node of the teapot and the
Collision detection time/ms
cylinder. The intersecting test of sphere and OBB is similar 70 RAPID algorithm
to the OBB algorithm, but the test is more rapid and simple, 60
at most only three times. The sphere bounding box is less 50
expensive to update than OBB, so the algorithm is less
expensive to update a bounding box than the RAPID 40
algorithm. The experimental results of the two algorithms are 30
shown in Table 1, and the efficiency comparison of the 20
algorithm is shown in Figure 4.
10
118
Advances in Computer Science Research, volume 79
[9]. In Unity, there are mainly static colliders such as Box V. CONCLUSION
Collider, Sphere Collider, Capsule Collider, Wheel Collider, This paper studies virtual campus roaming system based
and rigid body colliders for dynamic objects. In this system, on Virtual Reality Technology, Through the whole
a rigid body collider is added to the roaming role, and development process of the system, the implementation
various static colliders are added to the objects, such as principle of the collision detection technology and the
buildings, flowers and trees, and the ground. The information hybrid bounding box algorithm based on the encircling ball
processing of collision is realized through collision and the directed bounding box are emphasized.
occurrence, collision vanishing and collision maintaining
function in script [10], and a function of pop-up GUI ACKNOWLEDGMENT
interface is added to trigger the specific GUI interface in
collision occurrence function. This algorithm can also test Fund support: Shaanxi Education Department Special
the collision function of the system through the Game Fund Project number: Shaanxi Education Finance
interface in Unity. (GSYSJ20170009).
When a character collides with a building, the script will REFERENCES
trigger a collision event due to adding a collision body to a
[1] Tang Cui-Fang, Design and Implementation of Campus Roaming
specific building attachment. Then a pop-up information System Based on Virtual Reality Technology [J], Science and
window will be introduced to the corresponding building, Technology Innovation Herald, 2016, 20, 87-88.
and the result is shown in Figure 5. [2] Han Lei, Research on Virtual Building Roaming and Collision
Detection Based on Unity3D [J], Academic Exchange, 2016, 19, 194-
195+197.
[3] Wang Yu, Research and Application of Collision Detection in Virtual
Roaming System [J], Electronic Design Engineering, 2016, 13, 155–
156+160.
[4] Wang Feng-Qin, Research on Virtual Training System of Rock
Drilling Platform Based on Unity3D [D], Shijiazhuang Tiedao
University, Shijazhuang, 2016.
[5] Li Zhen, Research on Optimization Algorithm for Rigid Body
Collision Detection in Virtual Scene [D], Jilin Agricultural University,
Changchun, 2016.
[6] Wang Shuang, Cheng Yong-Dang, Kong Fan-Jin, and Yang Bin, A
Survey of Virtual Reality [J], Science & Technology Vision, 2016, 11,
129+153.
Figure 5. The information window displayed after the collision [7] Zhang Shao-Bo, Research on Key Technology of Human-computer
Interaction in Immersive Virtual Reality [D], Chongqing University
of Posts and Telecommunications, Chongqi, 2016.
We can know that the mixed level bounding box
[8] Zhang Jia-Jia, Optimization Simulation of Collision Detection in 3D
collision detection algorithm based on encircling ball and Virtual Environment [J], Computer Simulation, 2016, 03, 359-362.
OBB bounding box has also achieved very good results in [9] Lai Quan, Cha Mu-Ga, Jineerdemutu, and Jinhugejiletu,
developing the system. It not only enhances the reality of Development and Research of 3D Visualized Campus System Based
the scene, but also completes the trigger of the window pop- on Unity3D Platform [J], Sci-Tech Information Development &
up event through the detection of collision events, which Economy, 2016, 01, 124-127.
enhances the interactivity and makes the system more [10] Wang Lei, The Research of Collision Detection Technology Based on
humanized. Hybrid Bounding Box and Its Application in Web3D Roaming [D].
Shanghai University, Shanghai, 2015.
119