Conditions | 6 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
1 | class cModel(object): |
||
10 | def intersect(self, cother): |
||
11 | '''Check interesection between two colliders''' |
||
12 | if self.type == "AABB" and cother.getType() == "AABB": |
||
13 | # The following interesection test is for a AABBB |
||
14 | # The AABB has only 4 edges to check against |
||
15 | # This intersection function will be called by physics engine via physics object |
||
16 | # It returns a collisiondata object |
||
17 | # It will contains, direction, distance and state |
||
18 | for i in range(4): |
||
19 | for j in range(4): |
||
20 | ctemp = self.cmodel[i].IntersectAABB(cother.getCModel()[j]) |
||
21 | if ctemp.getState(): |
||
22 | print('Collision:', 'Dist:', ctemp.getDistance(), 'Dir:', ctemp.getDirection().vector) |
||
23 | else: |
||
24 | return NotImplemented |
||
25 | |||
47 |