【文章內(nèi)容簡介】
of distortion。 if the bounding volume is too big, the real time of collision will be bad, so, a proper design of bounding volume will produce the effect of getting twofold results with half the effort for the collision detection between objects. The step length of dynamic role also affects the precision of collision detection. If the step length of role is too big, the following situations probably happen: when the previous frame hasn’t collide with object, the next frame probably has gone through this object, which means that the penetration situation is very easy to happen for the object smaller than the step length of role. In order to prevent the penetrating, the step length of role shall be increased properly in the process of producing character animation.Segment collision detection algorithm: game system has low requirement for the precision of collision detection, but has higher requirement for the running speed of game. The static object in game scene do not need to take collision detection, and the collision would happen only between dynamic role and static object. The scene models of game are mostly regular object, so the adoption of AABB bounding volume is enough to express the object in scene approximately. The collision detection for two AABB objects needs to calculate at least for 6 times, while, if m collision detections are made before collision, 6m calculations between AABB polygons is needed. This not only has large calculation amount, but also waste of time, becase the answer could be obtained only with m calculations if there is no collision. The method for solution is to make crossing test with ray and static AABB before the collision of two objects. In this process, the AABB side that is possible to collide is confirmed, and is not changed into the side of dynamic AABB role and static AABB that is possible to collide until two objects is going to collide so as to make collision detection. However, the opportunity to decide to displace ray with AABB bounding volume is obtained through the distance of ray and AABB bounding volume of static object. With the improved collision detection algorithm, the calculation amount decreases nearly a half. The algorithm is described as follows: 1) select the central point S of bounding volume of player role and the vector V of moving direction and make a ray with(S, V) as parameter。 2) utilize BSP tree deposition method to quickly find the area that is probably take collision detection。 3) take the collision detection for the ray and static AABB object: estimate the distance between ray and static AABB object, estimate AABB side that probably collide, eliminate the side that is impossible to collide, if reach the set threshold, then continue。 take collision detection for dynamic AABB and static AABB plane, otherwise, turn back to.2. OPTIMIZATION OF ALGORITHMLarge storage space and slow calculation speed is the biggest disadvantage of A* path search algorithm. This article adopts three methods to optimize and improve path search. With the method of grading for path search, A* algorithm embodies the intelligence of NPC in path search, but has two def