![]() ![]() Its job to get the bounding box from tridi and create an array of line (4 line) represent each of object side. Its return 1-4 mean on which side the vector collide.īoxintersect source code is like this. To do it just call boxintersect with parameter is motion vector, object position and the object itself. So we need this vector to check is this vector collide with one of the four side of the object (box) ? From the picture we know that (xo,yo)-(xb,yb) is the ball motion vector. ![]() ![]() The rules is just like light reflection we learn in physic. % 360 (mod operator) is to ensure that vd is always in 0-359. This collision is simple to code, here:īasically that is a ball orientation modification when ball position (xb or yb) reach a limit position. So we have 2 collision detection code for our game. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |