Browse Source

2.3 update

shuvit 4 years ago
parent
commit
a8969ec21e

+ 2
- 2
assets/buildings.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:16fed1fd530befd4a96ce808b57abf6dd7dc828dac432105ce9a42197c715a45
3
-size 25388192
2
+oid sha256:c96d1d66e128a87127bfab82e64b56eae49c8e96e641a17bc120ea0b293ec1dd
3
+size 24263352

+ 2
- 2
assets/car1.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:201b5cce15fe189350d6d8145c7b3a4891ea8f8c7a0d2a0735036434f38a2372
3
-size 2003556
2
+oid sha256:4d50a7dd29dc4dd0d9ae2e25740c5ffb537636b0ef7cf935917ab7817e6d80a3
3
+size 2003676

BIN
assets/custom_shaders/__pycache__/custom_shader_utils.cpython-36.pyc View File


BIN
assets/custom_shaders/__pycache__/wind.cpython-36.pyc View File


+ 2
- 2
assets/materials/base_m_kit.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:8e8bbc46fe8a241bafb503b8fe9d3f8e054a5182a11d637f0c16b39fff237680
3
-size 43913896
2
+oid sha256:fcf8b75332373b727633a58789cee2807fedba5e91734d64427b5887ce2d34a1
3
+size 43913880

+ 1
- 1
assets/nav_points
File diff suppressed because it is too large
View File


+ 2
- 2
assets/roads.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:9c8a35c0558f473447386c4a32da1536dc5719c37262e8c1b8bb55cd3dd782b4
3
-size 20668232
2
+oid sha256:fe325b25aa6538776e4353502377f46a89a213f9bbbcf23325efbc1a2eacb6be
3
+size 38132636

+ 3
- 0
assets/user2-23.blend View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:ce237f858713d7c9eddfd078e64100322cad38373d53d9e877033677a764dd09
3
+size 12500776

+ 2
- 2
assets/user2.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:3b2527ea21c996d8837f676c7320b0fee9ed4fe5fe34fd5812fb4fd6f688d025
3
-size 12474024
2
+oid sha256:0a6c6de794fe00a7519740369793bd56366bc92ca7de9db7d967ee279f8df0ba
3
+size 13310152

+ 2
- 2
assets/user2_working.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:efa7cc116a67b09844712555de9d8cb5b613816dd753420aa0cdf0214755baa5
3
-size 4893180
2
+oid sha256:4c3671edb4e3bbb4f492d23f7d13bc3c9b1d8fc18f6e5f64c85cfba1db641da4
3
+size 4920184

+ 3
- 0
assets/user3_working.blend View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:0c331653e541e5f03039ea7dc7a2ada208be95c49050af883ef8109ed743782a
3
+size 4907104

+ 3
- 0
assets/user7_working.blend View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:97c45edaf1a6874e3828b4bf98111702306f315918a2d745e1c585d7cf9e8482
3
+size 10603800

+ 1
- 1
assets/walker_nav_points
File diff suppressed because it is too large
View File


+ 3
- 1
scripts/FSM.py View File

115
         'ExitParallelPark',
115
         'ExitParallelPark',
116
         'EnterParallelPark',
116
         'EnterParallelPark',
117
         'NavigateToTarget', 
117
         'NavigateToTarget', 
118
-        'RequestPath']
118
+        'RequestPath',
119
+        'EnterPerpPark', 
120
+        'ExitPerpPark']
119
 
121
 
120
         
122
         
121
         for s in state_list:
123
         for s in state_list:

+ 185
- 44
scripts/StatesCar.py View File

20
         if iter_ == (len(path) +1):
20
         if iter_ == (len(path) +1):
21
             pm.color = [1,0,1,.4]    
21
             pm.color = [1,0,1,.4]    
22
         y.path_display.append(pm)
22
         y.path_display.append(pm)
23
+def single_marker(pos, col):
24
+    pm = bge.logic.getCurrentScene().addObject('path_marker', None, 0)
25
+    pm.worldPosition = pos
26
+    pm.color = col
23
 
27
 
24
 def clear_markers(self):
28
 def clear_markers(self):
25
     for x in self.FSM.owner.path_display:
29
     for x in self.FSM.owner.path_display:
73
             
77
             
74
         return new_parking, path2
78
         return new_parking, path2
75
     else:
79
     else:
76
-        self.FSM.FSM.ToTransition('toEnterParallelPark')
80
+        get_parking_type(self)
81
+        #self.FSM.FSM.ToTransition('toEnterParallelPark')
77
 
82
 
78
 def get_lane_point(self):
83
 def get_lane_point(self):
79
     self.point = self.path[self.path_index]
84
     self.point = self.path[self.path_index]
88
 
93
 
89
 def update_point(self):
94
 def update_point(self):
90
     if self.path_index >= (len(self.path) ):
95
     if self.path_index >= (len(self.path) ):
91
-        self.FSM.FSM.ToTransition('toEnterParallelPark')
96
+        get_parking_type(self)
97
+        #self.FSM.FSM.ToTransition('toEnterParallelPark')
92
     else:
98
     else:
93
         dist = self.obj.getDistanceTo(self.lane_point)
99
         dist = self.obj.getDistanceTo(self.lane_point)
94
         self.point = self.path[self.path_index]
100
         self.point = self.path[self.path_index]
104
     v.z = 0
110
     v.z = 0
105
     self.obj.alignAxisToVect(v, 0, .05 * mult)
111
     self.obj.alignAxisToVect(v, 0, .05 * mult)
106
 
112
 
113
+def align_to_target(self, mult):
114
+    v = self.obj.getVectTo(self.FSM.FSM.curState.park_loc)[1]
115
+    v.z = 0
116
+    self.obj.alignAxisToVect(v, 0, .05 * mult)
117
+
118
+
107
 def delta_to_vect(self):
119
 def delta_to_vect(self):
108
     v = self.obj.getVectTo(self.lane_point)[1]
120
     v = self.obj.getVectTo(self.lane_point)[1]
109
     delta = self.last_lane_point - self.lane_point
121
     delta = self.last_lane_point - self.lane_point
125
         self.obj.applyForce([self.speed_inc * mult, 0, 0], True)
137
         self.obj.applyForce([self.speed_inc * mult, 0, 0], True)
126
 
138
 
127
 def starting_mod(self):
139
 def starting_mod(self):
128
-    #print('doing path mod')
129
-    #self.path[0] = self.start_empty.obj.worldPosition
130
-    #del self.path[0]
131
     path2 = self.path
140
     path2 = self.path
132
-    path2.append(self.target.obj.worldPosition) #add endpoint
133
-    path2.append(self.target.obj.worldPosition) 
134
-
135
-    #check if vector between 1 and start point and vector between 2 and sp are the same dir
136
-    # v1 = Vector(self.start_empty.obj.worldPosition).normalized() - Vector(self.path[0]).normalized()
137
-    # v2 = Vector(self.start_empty.obj.worldPosition).normalized() - Vector(self.path[1]).normalized()
138
-    # lens = []
139
-    # lens.append(len(self.path))
140
-    # if v1.dot(v2) < 0:
141
-    #     del self.path[0]
142
-    # lens.append(len(self.path))
143
-    # del self.path[0]   
144
-    # lens.append(len(self.path))
145
-    # del self.path[0]    
146
-    # lens.append(len(self.path))
147
-    # print(lens, 'path length', v1.dot(v2))
141
+    #path2.append(self.target.obj.worldPosition) #add endpoint
142
+    #path2.append(self.target.obj.worldPosition) 
148
 
143
 
149
 def check_front(self):    #
144
 def check_front(self):    #
150
-    #obj_vec = self.obj.worldOrientation[0].normalized()
151
     obj_vec = self.obj.getAxisVect([1,0,0])
145
     obj_vec = self.obj.getAxisVect([1,0,0])
152
     targ_vec = self.obj.getVectTo(self.path[self.path_index] +1)[1].normalized()
146
     targ_vec = self.obj.getVectTo(self.path[self.path_index] +1)[1].normalized()
153
     dot_ = obj_vec.dot(targ_vec)
147
     dot_ = obj_vec.dot(targ_vec)
154
 
148
 
155
-    # while dot_ < 0:
156
-    #     del self.path[0]
157
-    #     targ_vec = self.obj.getVectTo(self.path[0])[1].normalized()
158
-    #     dot_ = obj_vec.dot(targ_vec)
159
     if dot_ > 0:
149
     if dot_ > 0:
160
         print('in front', self)
150
         print('in front', self)
161
     else:
151
     else:
164
     if dot_ > 0:
154
     if dot_ > 0:
165
         return True
155
         return True
166
     else:
156
     else:
157
+        return False    
158
+
159
+def get_parking_type(self):
160
+    if self.target.type == 'perp':
161
+        self.FSM.FSM.ToTransition('toEnterPerpPark')
162
+    else:
163
+        self.FSM.FSM.ToTransition('toEnterParallelPark')
164
+
165
+def get_parking_point(self):
166
+    v = Vector([self.last_lane_point.x - self.point.x, self.last_lane_point.y - self.point.y, 0])
167
+    tv = v.normalized()
168
+    #nv = Vector([-tv.y, tv.x, 0]) #rotate 90 degrees
169
+    #self.last_lane_point = self.lane_point
170
+
171
+    local = Vector([7,0,0])
172
+    return Vector(self.target.obj.worldPosition + (self.target.obj.worldOrientation * local))
173
+
174
+
175
+    #return Vector(self.target.obj.worldPosition) - 7 * tv
176
+
177
+def move_to_point(self):
178
+    #print(self.v_to_target[0])
179
+    if self.v_to_target[0] < .95:
180
+        #print('reached')
181
+        return True
182
+    else:
183
+        vectTo = Vector(self.v_to_target[1])
184
+        vectTo.magnitude = 4.01
185
+        self.FSM.owner.obj.linearVelocity = vectTo
167
         return False
186
         return False
168
-    #get starting pos
169
-    # v = Vector([path2[0].x - path2[1].x, path2[0].y - path2[1].y, 0])
170
-    # tv = v.normalized()
171
-    # nv = Vector([-tv.y, tv.x, 0])
172
-    # print('og', path2[0])
173
-    # path2[0] = path2[0] + -.2 * nv
174
-    # print('mod1', path2[0])
175
-    # #path2[0] *= nv
176
-    # print('mod2', path2[0])    
177
-    # self.path = path2    
187
+
188
+def forward_ray(self):
189
+
190
+    Axis = 0
191
+    Distance = 30
192
+    End = self.obj.worldPosition + (self.obj.worldOrientation.col[Axis]*Distance)
193
+    Start = self.obj.worldPosition.copy()
194
+    return self.obj.rayCast(End, Start, 10,'traffic', 1, 0, 0)
195
+    
196
+#dist = v1[0]
197
+#print(dist)    
178
 
198
 
179
 #====================================     
199
 #====================================     
180
 
200
 
222
         self.FSM.owner.obj.restoreDynamics()
242
         self.FSM.owner.obj.restoreDynamics()
223
         self.FSM.owner.obj.linearVelocity = [0,0,0]
243
         self.FSM.owner.obj.linearVelocity = [0,0,0]
224
         self.FSM.owner.path_index = 1
244
         self.FSM.owner.path_index = 1
225
-        get_lane_point(self.FSM.owner)
245
+        
226
         try:
246
         try:
227
             self.FSM.owner.point = self.FSM.owner.path[self.FSM.owner.path_index]
247
             self.FSM.owner.point = self.FSM.owner.path[self.FSM.owner.path_index]
248
+            get_lane_point(self.FSM.owner)
228
         except:
249
         except:
229
             print('no path')    
250
             print('no path')    
230
         self.FSM.owner.target.status = 'targetted'
251
         self.FSM.owner.target.status = 'targetted'
264
 
285
 
265
 #====================================  
286
 #====================================  
266
             
287
             
288
+
289
+class ExitPerpPark(State):
290
+    def __init__(self,FSM):
291
+        super(ExitPerpPark, self).__init__(FSM)    
292
+        
293
+    def Enter(self):
294
+        self.FSM.stateLife = 1
295
+        self.FSM.owner.obj.restorePhysics()
296
+        self.FSM.owner.obj.restoreDynamics()
297
+        self.FSM.owner.obj.linearVelocity = [0,0,0]
298
+        self.FSM.owner.path_index = 1
299
+        
300
+        try:
301
+            self.FSM.owner.point = self.FSM.owner.path[self.FSM.owner.path_index]
302
+            get_lane_point(self.FSM.owner)
303
+        except:
304
+            print('no path')    
305
+        self.FSM.owner.target.status = 'targetted'
306
+        self.FSM.owner.start_empty.status = 'available'
307
+        starting_mod(self.FSM.owner)
308
+        super(ExitPerpPark, self).Enter()        
309
+        
310
+    def Execute(self):
311
+        #print('exiting perp park', self.FSM.owner.start_empty.type)
312
+        self.FSM.stateLife += 1
313
+        set_height(self.FSM.owner)
314
+        if self.FSM.owner.path != []:
315
+            update_point(self.FSM.owner)
316
+            if self.FSM.owner.path_index > 1 or self.FSM.stateLife > 300:    
317
+                self.FSM.ToTransition('toNavigateToTarget')
318
+            
319
+
320
+            #align_to_point(self.FSM.owner, .65)
321
+            align_to_road(self.FSM.owner)
322
+            #set_height(self.FSM.owner)
323
+            #delta_to_vect(self.FSM.owner)
324
+            #apply_gas(self.FSM.owner, .5)  
325
+
326
+            if self.FSM.stateLife < 120:
327
+                self.FSM.owner.obj.applyForce([-50,0,0], True)  
328
+
329
+    def Exit(self):
330
+        pass        
331
+
332
+#====================================  
333
+            
334
+
335
+
336
+
337
+
338
+
339
+
267
 class EnterParallelPark(State):
340
 class EnterParallelPark(State):
268
     def __init__(self,FSM):        
341
     def __init__(self,FSM):        
269
         super(EnterParallelPark, self).__init__(FSM)    
342
         super(EnterParallelPark, self).__init__(FSM)    
270
         
343
         
271
     def Enter(self):
344
     def Enter(self):
272
         self.FSM.stateLife = 1
345
         self.FSM.stateLife = 1
346
+        
347
+        clear_markers(self)
348
+        super(EnterParallelPark, self).Enter() 
349
+
350
+    def cleanup(self):
273
         self.FSM.owner.obj.worldPosition = self.FSM.owner.target.obj.worldPosition.copy()
351
         self.FSM.owner.obj.worldPosition = self.FSM.owner.target.obj.worldPosition.copy()
274
         self.FSM.owner.obj.worldOrientation = self.FSM.owner.target.obj.worldOrientation.copy()
352
         self.FSM.owner.obj.worldOrientation = self.FSM.owner.target.obj.worldOrientation.copy()
275
         self.FSM.owner.obj.applyMovement([0, -6, 0], True)
353
         self.FSM.owner.obj.applyMovement([0, -6, 0], True)
283
         self.FSM.owner.point = self.FSM.owner.target.obj.worldPosition.copy()
361
         self.FSM.owner.point = self.FSM.owner.target.obj.worldPosition.copy()
284
         self.FSM.owner.path_index = 0
362
         self.FSM.owner.path_index = 0
285
         self.FSM.owner.path = None
363
         self.FSM.owner.path = None
286
-        clear_markers(self)
287
-        super(EnterParallelPark, self).Enter()        
364
+
365
+        self.FSM.owner.manager.cars_active.remove(self.FSM.owner)
366
+        self.FSM.owner.obj.suspendDynamics()       
288
         
367
         
289
     def Execute(self):
368
     def Execute(self):
290
         self.FSM.stateLife += 1
369
         self.FSM.stateLife += 1
291
-        if self.FSM.stateLife == 2:
292
-            self.FSM.owner.manager.cars_active.remove(self.FSM.owner)
293
-            self.FSM.owner.obj.suspendDynamics()
370
+        if self.FSM.stateLife == 240:
371
+            self.cleanup()    
294
             #self.FSM.owner.obj.suspendPhysics()
372
             #self.FSM.owner.obj.suspendPhysics()
295
     def Exit(self):
373
     def Exit(self):
296
         pass
374
         pass
297
 
375
 
376
+class EnterPerpPark(State):
377
+    def __init__(self,FSM):        
378
+        super(EnterPerpPark, self).__init__(FSM)    
379
+
380
+    def Enter(self):
381
+        self.FSM.stateLife = 1
382
+        self.park_loc = get_parking_point(self.FSM.owner)
383
+        single_marker(self.park_loc, [1,0,0,.3])
384
+
385
+        clear_markers(self)
386
+        super(EnterPerpPark, self).Enter()     
387
+
388
+    def cleanup(self):
389
+        self.FSM.owner.obj.worldPosition = self.FSM.owner.target.obj.worldPosition.copy()
390
+        self.FSM.owner.obj.worldOrientation = self.FSM.owner.target.obj.worldOrientation.copy()
391
+        self.FSM.owner.obj.applyMovement([7, 0, 0], True)
392
+        self.FSM.owner.target.status = 'in_use'
393
+        self.FSM.owner.obj.worldPosition.z += .9
394
+        self.FSM.owner.active = False
395
+        self.FSM.owner.start_empty = self.FSM.owner.target
396
+        self.FSM.owner.last_point = self.FSM.owner.target.obj.worldPosition.copy()
397
+        self.FSM.owner.lane_point = self.FSM.owner.target.obj.worldPosition.copy()
398
+        self.FSM.owner.last_lane_point = self.FSM.owner.target.obj.worldPosition.copy()
399
+        self.FSM.owner.point = self.FSM.owner.target.obj.worldPosition.copy()
400
+        self.FSM.owner.path_index = 0
401
+        self.FSM.owner.path = None
402
+
403
+        self.FSM.owner.manager.cars_active.remove(self.FSM.owner)
404
+        self.FSM.owner.obj.suspendDynamics()       
405
+        
406
+    def Execute(self):
407
+        self.FSM.stateLife += 1
408
+
409
+        self.v_to_target = self.FSM.owner.obj.getVectTo(self.park_loc)
410
+
411
+        goal_met = move_to_point(self)
412
+        set_height(self.FSM.owner)
413
+        if self.v_to_target[0] > 2:
414
+
415
+            align_to_target(self.FSM.owner, .65)
416
+
417
+        else:
418
+            self.FSM.owner.obj.alignAxisToVect(-self.FSM.owner.target.obj.worldOrientation[0], 0, .05)
419
+
420
+        if self.FSM.stateLife == 440 or goal_met:
421
+            self.cleanup()    
422
+            #self.FSM.owner.obj.suspendPhysics()
423
+
424
+    def Exit(self):
425
+        pass        
426
+
298
 #==================================== 
427
 #==================================== 
299
 
428
 
300
 class NavigateToTarget(State):
429
 class NavigateToTarget(State):
308
         
437
         
309
     def Execute(self):
438
     def Execute(self):
310
         self.FSM.stateLife += 1
439
         self.FSM.stateLife += 1
440
+        self.forward_ray = forward_ray(self.FSM.owner)
311
         update_point(self.FSM.owner)
441
         update_point(self.FSM.owner)
312
 
442
 
313
         align_to_point(self.FSM.owner, 1)
443
         align_to_point(self.FSM.owner, 1)
314
         align_to_road(self.FSM.owner)
444
         align_to_road(self.FSM.owner)
315
         set_height(self.FSM.owner)
445
         set_height(self.FSM.owner)
316
         delta_to_vect(self.FSM.owner)
446
         delta_to_vect(self.FSM.owner)
317
-        apply_gas(self.FSM.owner, 1)
447
+        gas = True
448
+        if self.forward_ray[0]:
449
+            
450
+            dist = self.FSM.owner.obj.getDistanceTo(self.forward_ray[1])
451
+            if dist < 10:
452
+                gas = False
453
+                self.FSM.owner.obj.linearVelocity.x *= .98
454
+            print(dist, 'forward ray', self.forward_ray[0])
455
+        
456
+        if gas:
457
+            apply_gas(self.FSM.owner, 1)
318
 
458
 
319
         #emergency exit
459
         #emergency exit
320
         if self.FSM.stateLife > 30 * 90:
460
         if self.FSM.stateLife > 30 * 90:
321
-            self.FSM.ToTransition('toEnterParallelPark')
461
+            get_parking_type(self.FSM.owner)
462
+            #self.FSM.ToTransition('toEnterParallelPark')
322
 
463
 
323
     def Exit(self):
464
     def Exit(self):
324
         pass        
465
         pass        

+ 6
- 3
scripts/astar.py View File

99
         self.life += 1
99
         self.life += 1
100
         if self.state == 'searching':
100
         if self.state == 'searching':
101
             self.search()
101
             self.search()
102
-            if self.life > 3000:
102
+            print('open', len(self.open))
103
+            if self.life > 2000:
103
                 print('path failed', self.current_searcher)
104
                 print('path failed', self.current_searcher)
105
+                self.messenger.dispatch('path found', ['failed', self.current_searcher, []])
104
                 self.state = 'idle'
106
                 self.state = 'idle'
107
+
105
         else:
108
         else:
106
             self.update_queue()        
109
             self.update_queue()        
107
              
110
              
122
                 break
125
                 break
123
         results.reverse()
126
         results.reverse()
124
         self.messenger.dispatch('path found', ['path', self.current_searcher, results])
127
         self.messenger.dispatch('path found', ['path', self.current_searcher, results])
125
-        print('path found', self.current_searcher)
128
+        #print('path found', self.current_searcher)
126
 
129
 
127
     def smallest_f(self):
130
     def smallest_f(self):
128
-        if len(self.open) > 1:
131
+        if len(self.open) >= 1:
129
             l = []
132
             l = []
130
             lfs = []
133
             lfs = []
131
             for x in self.open:
134
             for x in self.open:

+ 16
- 1
scripts/camera.py View File

9
 import FSM
9
 import FSM
10
 import cars
10
 import cars
11
 import walkers
11
 import walkers
12
+import occluders
12
 
13
 
13
 def main(cont):
14
 def main(cont):
14
     own = cont.owner
15
     own = cont.owner
68
         #own['NpcPedFSM'] = FSM.NpcPed(own)
69
         #own['NpcPedFSM'] = FSM.NpcPed(own)
69
         own['CamFSM'] = FSM.CameraFSM(own)
70
         own['CamFSM'] = FSM.CameraFSM(own)
70
         own['life'] = 0
71
         own['life'] = 0
72
+        occluders.place()
71
     acam = scene.active_camera
73
     acam = scene.active_camera
72
 
74
 
73
     def get_cam_state():
75
     def get_cam_state():
363
     else:
365
     else:
364
         pass
366
         pass
365
 
367
 
366
-    own['life'] += 1
368
+    own['life'] += 1
369
+
370
+    # mo = scene.objects['Suzanne']
371
+    # print(mo.culled)
372
+
373
+    # if dict['kb_a'] == True and dict['last_kb_a'] == False:
374
+        
375
+    #     if scene.active_camera == scene.objects['tmp_cam2']:
376
+    #         scene.active_camera = scene.objects['tmp_cam']
377
+    #         print('change cam tmp', scene.active_camera)
378
+    #     else:
379
+    #         scene.active_camera = scene.objects['tmp_cam2']
380
+
381
+    #         print('change cam og', scene.active_camera)

+ 20
- 5
scripts/cars.py View File

22
 	for obj in bge.logic.getCurrentScene().objects:
22
 	for obj in bge.logic.getCurrentScene().objects:
23
 		if 'parking' in obj:
23
 		if 'parking' in obj:
24
 			ps = ParkingSpot(obj, 'available')
24
 			ps = ParkingSpot(obj, 'available')
25
+			if 'perp' in obj:
26
+				ps.type = 'perp'
27
+			else:
28
+				ps.type = 'parallel'
25
 			op.append(ps)
29
 			op.append(ps)
26
 	return op
30
 	return op
27
 
31
 
37
 	car = bge.logic.getCurrentScene().addObject('car_collider', x.obj, 0)
41
 	car = bge.logic.getCurrentScene().addObject('car_collider', x.obj, 0)
38
 	car.worldOrientation = x.obj.worldOrientation
42
 	car.worldOrientation = x.obj.worldOrientation
39
 	car.worldPosition.z += .8
43
 	car.worldPosition.z += .8
40
-	car.applyMovement([0, -6, 0], True)
44
+	if x.type == 'perp':
45
+		car.applyMovement([7, 0, 0], True)
46
+	else:
47
+		car.applyMovement([0, -6, 0], True)
41
 	car.suspendDynamics()
48
 	car.suspendDynamics()
42
 	#car.suspendPhysics()	
49
 	#car.suspendPhysics()	
43
 	car.name = 'lcar' + str(len(self.manager.cars))
50
 	car.name = 'lcar' + str(len(self.manager.cars))
54
 class ParkingSpot:
61
 class ParkingSpot:
55
 	def __init__(self, obj, status):
62
 	def __init__(self, obj, status):
56
 		self.obj = obj
63
 		self.obj = obj
64
+		self.type = None
57
 		self.status = status
65
 		self.status = status
58
 
66
 
59
 class Car:
67
 class Car:
82
 		if self == message[1]:
90
 		if self == message[1]:
83
 			self.path = message[2]
91
 			self.path = message[2]
84
 			if self.path != []:
92
 			if self.path != []:
85
-				self.FSM.FSM.ToTransition('toExitParallelPark')
93
+				print(self.start_empty.type, 'target type')
94
+				if self.start_empty.type == 'perp':
95
+					self.FSM.FSM.ToTransition('toExitPerpPark')
96
+				else:
97
+					self.FSM.FSM.ToTransition('toExitParallelPark')
98
+					print('setting goal available after failure', self.FSM.owner.target.obj.worldPosition)
99
+					self.FSM.owner.target.status = 'available'
86
 			else:
100
 			else:
87
 				print('path failed for', self)
101
 				print('path failed for', self)
88
-				self.FSM.FSM.ToTransition('toEnterParallelPark')	
102
+				self.FSM.FSM.ToTransition('toEnterParallelPark')
103
+
89
 		
104
 		
90
 class CarManager:
105
 class CarManager:
91
 	def __init__(self, own):
106
 	def __init__(self, own):
94
 		self.pub = observer.Publisher(['path found', 'working'])
109
 		self.pub = observer.Publisher(['path found', 'working'])
95
 		self.navmesh2 =  astar.Astar('nav_points', self.pub)
110
 		self.navmesh2 =  astar.Astar('nav_points', self.pub)
96
 		self.cars = []
111
 		self.cars = []
97
-		self.max_cars = 6
98
-		self.max_active = 4
112
+		self.max_cars = 10
113
+		self.max_active = 6
99
 		self.targets = []
114
 		self.targets = []
100
 		self.target_loc = None
115
 		self.target_loc = None
101
 		self.parking_spots = get_parking_spots()
116
 		self.parking_spots = get_parking_spots()

+ 11
- 0
scripts/occluders.py View File

1
+import bge
2
+
3
+def place():
4
+	scene = bge.logic.getCurrentScene()
5
+	for x in scene.objects:
6
+		if 'occluder_tmp' in x.name:
7
+			print('place occluder')
8
+			o = scene.addObject('occluder_obj', x)
9
+			o.worldOrientation = x.worldOrientation
10
+			o.worldScale = x.worldScale
11
+			x.endObject()

+ 2
- 2
scripts/walkers.py View File

116
 		self.pub = observer.Publisher(['path found', 'working'])
116
 		self.pub = observer.Publisher(['path found', 'working'])
117
 		self.navmesh2 =  astar.Astar('walker_nav_points', self.pub)
117
 		self.navmesh2 =  astar.Astar('walker_nav_points', self.pub)
118
 		self.walkers = []
118
 		self.walkers = []
119
-		self.max_walkers = 16
120
-		self.max_active = 8
119
+		self.max_walkers = 5
120
+		self.max_active = 3
121
 		self.targets = []
121
 		self.targets = []
122
 		self.target_loc = None
122
 		self.target_loc = None
123
 		self.idle_spots = get_idle_spots()
123
 		self.idle_spots = get_idle_spots()

+ 3
- 0
shuvit23.blend View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:c7a95ab819b4cb0ae5c46b4662e8f139e79f02cec48ad8a5240e7b2a584897e4
3
+size 120592856

+ 3
- 0
shuvit23a1.blend View File

1
+version https://git-lfs.github.com/spec/v1
2
+oid sha256:92c47d52d95b1b4c39d8d821202a6bce8fceaa2f73cbce02dfe9e6e1dcb545a0
3
+size 67591136

Loading…
Cancel
Save