Browse Source

cam_linting

shuvit 5 years ago
parent
commit
7232b459f9
5 changed files with 108 additions and 151 deletions
  1. 2
    2
      assets/kits/base_kit.blend
  2. 2
    2
      assets/materials/base_m_kit.blend
  3. 2
    2
      assets/user2.blend
  4. 100
    143
      scripts/camera.py
  5. 2
    2
      shuvit.blend

+ 2
- 2
assets/kits/base_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:e1d3fa914e577d76f1aafa98bb2c4eb255af844b759d277c13d8d075a28d3dff
3
-size 20186144
2
+oid sha256:62549263728c2ef7660fbcdce7d2b5b9619860e5d4627d6610562078ce8e1891
3
+size 26221544

+ 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:da2b7a5bdd1d133e398ceb3abdfaeca7d98b3f1092ef55adf0589756a1528a5a
3
-size 18290540
2
+oid sha256:50c185109ee56fcb1bbbba94987bdd7ae0ea73ab2e35ad91a7af8b0a758a57f6
3
+size 22674664

+ 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:6bfcbe11735b600e9920ff042ea0093c974a8f42f8a66943da148a70b178a8ed
3
-size 36542248
2
+oid sha256:5463f5a80d4070c362d7d2b03aaab46ee722af0993cade6b8f3961187adbb1f2
3
+size 36552232

+ 100
- 143
scripts/camera.py View File

4
 from mathutils import *
4
 from mathutils import *
5
 scene = bge.logic.getCurrentScene()
5
 scene = bge.logic.getCurrentScene()
6
 import camFSM
6
 import camFSM
7
-#cont = bge.logic.getCurrentController()
8
-#own = cont.owner
7
+
9
 def main(cont):
8
 def main(cont):
10
     #camFSM.main(cont)
9
     #camFSM.main(cont)
11
     own = cont.owner
10
     own = cont.owner
12
-    dict = bge.logic.globalDict 
11
+    dict = bge.logic.globalDict
13
     camempty = scene.objects['camEmpty.001']
12
     camempty = scene.objects['camEmpty.001']
14
     controlcube = scene.objects['control_cube.002']
13
     controlcube = scene.objects['control_cube.002']
15
-    
16
     camCube = scene.objects['camCube']
14
     camCube = scene.objects['camCube']
17
-    
18
     dropinCol = controlcube.sensors['dropinCol']
15
     dropinCol = controlcube.sensors['dropinCol']
19
     LAST_GRIND = controlcube['LAST_GRIND']
16
     LAST_GRIND = controlcube['LAST_GRIND']
20
     up = cont.sensors['up']
17
     up = cont.sensors['up']
26
     cam = cont.actuators["Camera"]
23
     cam = cont.actuators["Camera"]
27
     near = cont.sensors["Near"]
24
     near = cont.sensors["Near"]
28
     move = own.actuators["move"]
25
     move = own.actuators["move"]
29
-    #match camera actuaotor
30
-    cam_def_height = dict['cam_height'] #-.1 #-.6
31
-    #cam_def_min = 1.6
32
-    #cam_def_max = 2.4
26
+    cam_def_height = dict['cam_height']
33
     cam_def_min = dict['cam_min']
27
     cam_def_min = dict['cam_min']
34
     cam_def_max = dict['cam_max']
28
     cam_def_max = dict['cam_max']
35
-    cam_height = cam.height 
36
-    cam_min = cam.min   
29
+    cam_height = cam.height
30
+    cam_min = cam.min
37
     cam_max = cam.max
31
     cam_max = cam.max
38
     lasty = controlcube['lasty']
32
     lasty = controlcube['lasty']
39
     cam_moved = 0
33
     cam_moved = 0
44
     ccheight = controlcube.worldPosition[2]
38
     ccheight = controlcube.worldPosition[2]
45
     camwpz = own.worldPosition[2]
39
     camwpz = own.worldPosition[2]
46
     zdist = camwpz - ccheight
40
     zdist = camwpz - ccheight
47
-    
48
     cam1 = scene.objects['Camera.003']
41
     cam1 = scene.objects['Camera.003']
49
     cam2 = scene.objects['freecam']
42
     cam2 = scene.objects['freecam']
50
     cam3 = scene.objects['followcam']
43
     cam3 = scene.objects['followcam']
51
-    
52
     camList = scene.cameras
44
     camList = scene.cameras
53
-    freecam = camList["freecam"]     
54
-    
45
+    freecam = camList["freecam"]
46
+
55
     if 'init' not in own:
47
     if 'init' not in own:
56
         own['init'] = 1
48
         own['init'] = 1
57
         own['last_move_x'] = 0
49
         own['last_move_x'] = 0
61
         own['last_rot_y'] = 0
53
         own['last_rot_y'] = 0
62
         own['last_rot_z'] = 0
54
         own['last_rot_z'] = 0
63
         own['idlecampos_x'] = 0
55
         own['idlecampos_x'] = 0
64
-        own['speed_mult'] = 1.00 
65
-        controlcube['driving'] = False  
56
+        own['speed_mult'] = 1.00
57
+        controlcube['driving'] = False
66
         dict['cur_ccH_min'] = dict['cam_walk_min']
58
         dict['cur_ccH_min'] = dict['cam_walk_min']
67
         dict['cur_ccH_max'] = dict['cam_walk_max']
59
         dict['cur_ccH_max'] = dict['cam_walk_max']
68
         cam.height = dict['cam_height']
60
         cam.height = dict['cam_height']
69
     acam = scene.active_camera
61
     acam = scene.active_camera
70
 
62
 
71
-
72
-    
73
-    #if 1 == 1:
74
-    #if own['playback'] == False:
75
     if controlcube['driving'] == False:
63
     if controlcube['driving'] == False:
76
         LAST_GRIND = False
64
         LAST_GRIND = False
77
         if down.triggered == True and LAST_GRIND == False and walk == 0:
65
         if down.triggered == True and LAST_GRIND == False and walk == 0:
78
             hitPosition = down.hitPosition
66
             hitPosition = down.hitPosition
79
             distance = own.getDistanceTo(hitPosition)
67
             distance = own.getDistanceTo(hitPosition)
80
-            cam_moved = 1  
81
-            if 'vert' not in down.hitObject:     
68
+            cam_moved = 1
69
+            if 'vert' not in down.hitObject:
82
                 if distance < .2:
70
                 if distance < .2:
83
                     camempty['hitdown'] = True
71
                     camempty['hitdown'] = True
84
                     cam.height = cam_height + .3
72
                     cam.height = cam_height + .3
85
-                    cam.damping = .0 
73
+                    cam.damping = .0
86
                     print("raise cam")
74
                     print("raise cam")
87
                 if zdist < -.2:
75
                 if zdist < -.2:
88
                     cam.height = lastCamheight + .01
76
                     cam.height = lastCamheight + .01
89
                     cam.damping = .0
77
                     cam.damping = .0
90
-                    raised = 1    
78
+                    raised = 1
91
                 if (distance > .4 and distance < .6) and zdist > -.2 and raised == 0:
79
                 if (distance > .4 and distance < .6) and zdist > -.2 and raised == 0:
92
                     camheight2 = cam.height - .001
80
                     camheight2 = cam.height - .001
93
-                    if cam.height < .2: 
81
+                    if cam.height < .2:
94
                         cam.height = camheight2
82
                         cam.height = camheight2
95
-                        #print("slow lower")
96
                 if distance >= .6 and zdist > -.2 and raised == 0:
83
                 if distance >= .6 and zdist > -.2 and raised == 0:
97
                     cam.height = cam.height - .02
84
                     cam.height = cam.height - .02
98
-                    #print("slow lower2")           
99
         if down.triggered == False and LAST_GRIND == False and cam_moved == 0 and walk == 0:
85
         if down.triggered == False and LAST_GRIND == False and cam_moved == 0 and walk == 0:
100
             camempty['hitdown'] = False
86
             camempty['hitdown'] = False
101
             if cam_height > (cam_def_height + .06) and zdist > -.2 and raised == 0:
87
             if cam_height > (cam_def_height + .06) and zdist > -.2 and raised == 0:
102
                 cam.height = cam_height - .02
88
                 cam.height = cam_height - .02
103
         if cam_height < -.6 and cam_moved == 0 and LAST_GRIND == False and zdist > -.2 and raised == 0 and walk == 0:
89
         if cam_height < -.6 and cam_moved == 0 and LAST_GRIND == False and zdist > -.2 and raised == 0 and walk == 0:
104
-            cam_height = .1  
90
+            cam_height = .1
105
         if LAST_GRIND == True and walk == 0:
91
         if LAST_GRIND == True and walk == 0:
106
             if cam.height < -.5 or zdist < -.2:
92
             if cam.height < -.5 or zdist < -.2:
107
                 cam.height = cam.height + .013
93
                 cam.height = cam.height + .013
108
             if cam.height >= -.5 and not down.triggered:
94
             if cam.height >= -.5 and not down.triggered:
109
                 pass
95
                 pass
110
-        
96
+
111
         if walk == 1:
97
         if walk == 1:
112
             if dropinCol.positive == True and lasty == True:
98
             if dropinCol.positive == True and lasty == True:
113
-                pass 
99
+                pass
114
             else:
100
             else:
115
-                pass   
116
-        controlcube['lastCamheight'] = cam.height    
117
-        #########
118
-        #cam.min = dict['cam_min']
119
-        #cam.max = dict['cam_max']
120
-        cont.activate(own.actuators['Camera'])  
121
-        ########
122
-        
101
+                pass
102
+        controlcube['lastCamheight'] = cam.height
103
+        #activating######
104
+        cont.activate(own.actuators['Camera'])
105
+        #################
123
         if near.triggered == True and walk == 0:
106
         if near.triggered == True and walk == 0:
124
             #print("near")
107
             #print("near")
125
             if cam.min < 1:
108
             if cam.min < 1:
129
             print('moving cam up')
112
             print('moving cam up')
130
             cam.damping = .001
113
             cam.damping = .001
131
             cont.activate(move)
114
             cont.activate(move)
132
-            
115
+
133
         else:
116
         else:
134
             #print("far")
117
             #print("far")
135
             cont.deactivate(move)
118
             cont.deactivate(move)
136
             if cam.min > cam_def_min:
119
             if cam.min > cam_def_min:
137
                 cam.min = cam.min - .05
120
                 cam.min = cam.min - .05
138
-                cam.max = cam.max - .05 
139
-            cam.damping = .0          
121
+                cam.max = cam.max - .05
122
+            cam.damping = .0
140
         if cam.damping != 0 and down.triggered == False and near.triggered == False:
123
         if cam.damping != 0 and down.triggered == False and near.triggered == False:
141
-            cam.damping = 0.91             
124
+            cam.damping = 0.91
142
 
125
 
143
         obj = cont.owner
126
         obj = cont.owner
144
         cube = controlcube
127
         cube = controlcube
145
         to = cube
128
         to = cube
146
-        #print(to.worldPosition)
147
         to2 = to.worldPosition
129
         to2 = to.worldPosition
148
         pos = [to.worldPosition.x, to.worldPosition.y, to.worldPosition.z]
130
         pos = [to.worldPosition.x, to.worldPosition.y, to.worldPosition.z]
149
-        
150
         pos[2] = pos[2] - .2
131
         pos[2] = pos[2] - .2
151
-        #print(pos)
152
-
153
         from2 = obj
132
         from2 = obj
154
-        #print(from2)
155
         from3 = [from2.worldPosition.x, from2.worldPosition.y, from2.worldPosition.z]
133
         from3 = [from2.worldPosition.x, from2.worldPosition.y, from2.worldPosition.z]
156
         from3[2] = from3[2] - .2
134
         from3[2] = from3[2] - .2
157
         distance = 0.0
135
         distance = 0.0
160
         xray = 0
138
         xray = 0
161
         poly = 0
139
         poly = 0
162
         hit = obj.rayCast( pos, from3, distance, property, face, xray, poly)
140
         hit = obj.rayCast( pos, from3, distance, property, face, xray, poly)
163
-        #bge.render.drawLine(pos,from3, [1,0,0])
164
         control = "control_cube.002"
141
         control = "control_cube.002"
165
         hitobj = hit[0]
142
         hitobj = hit[0]
166
         hitobj = str(hitobj)
143
         hitobj = str(hitobj)
144
+        if 'ragdoll_active' not in controlcube:
145
+            controlcube['ragdoll_active'] = False
167
         if hit[0]:
146
         if hit[0]:
168
             if hitobj != control and walk == 0 and 'vert' not in hit[0] and 'ground' in hit[0] and controlcube['ragdoll_active'] == False:
147
             if hitobj != control and walk == 0 and 'vert' not in hit[0] and 'ground' in hit[0] and controlcube['ragdoll_active'] == False:
169
-                
170
-                cam.damping = .0 
148
+                cam.damping = .0
171
                 if cam.height < 2:
149
                 if cam.height < 2:
172
                     cam.height = cam_height + .1
150
                     cam.height = cam_height + .1
173
                     cam.max = cam.max - .2
151
                     cam.max = cam.max - .2
174
                     print('small move')
152
                     print('small move')
175
                 elif cam.height >= 2 and cam.height < 4:
153
                 elif cam.height >= 2 and cam.height < 4:
176
                     cam.height = cam_height + .05
154
                     cam.height = cam_height + .05
177
-                    cam.max = cam.max - .05                
155
+                    cam.max = cam.max - .05
178
                     print('big move')
156
                     print('big move')
179
-        
157
+
180
     if dict['menu_idle_timer'] > 300:
158
     if dict['menu_idle_timer'] > 300:
181
         move_len = 2048
159
         move_len = 2048
182
         if own['idlecampos_x'] < move_len:
160
         if own['idlecampos_x'] < move_len:
183
             own['idlecampos_x'] += 1
161
             own['idlecampos_x'] += 1
184
         if own['idlecampos_x'] == move_len:
162
         if own['idlecampos_x'] == move_len:
185
-           own['idlecampos_x'] = 0     
186
-            
163
+           own['idlecampos_x'] = 0
164
+
187
         if own['idlecampos_x'] < (move_len / 2):
165
         if own['idlecampos_x'] < (move_len / 2):
188
             move = [.0001, 0, 0]
166
             move = [.0001, 0, 0]
189
             freecam.applyMovement( move, True)
167
             freecam.applyMovement( move, True)
190
-            freecam.applyRotation([.0001, 0, .0001],True)
168
+            freecam.applyRotation([.0001, 0, .0001], True)
191
         if own['idlecampos_x'] > (move_len / 2):
169
         if own['idlecampos_x'] > (move_len / 2):
192
             move = [-.0001, 0, 0]
170
             move = [-.0001, 0, 0]
193
-            freecam.applyMovement( move, True)
194
-            freecam.applyRotation([-.0001, 0, -.0001],True)        
195
-        
171
+            freecam.applyMovement(move, True)
172
+            freecam.applyRotation([-.0001, 0, -.0001], True)
173
+
196
     if dict['npause'] == True:
174
     if dict['npause'] == True:
197
         cont.deactivate(own.actuators['Camera'])
175
         cont.deactivate(own.actuators['Camera'])
198
         controlcube['camera'] = 2
176
         controlcube['camera'] = 2
199
     if controlcube['camera'] == 2 and dict['joy_con'] == 1:
177
     if controlcube['camera'] == 2 and dict['joy_con'] == 1:
200
         cont.deactivate(own.actuators['Camera'])
178
         cont.deactivate(own.actuators['Camera'])
201
-        scene.active_camera = freecam 
202
-        cont.activate(cube.actuators['freecam']) 
203
-        #print('activating camera', freecam)  
204
-#####        
205
-    #get value 0-100    
179
+        scene.active_camera = freecam
180
+        cont.activate(cube.actuators['freecam'])
206
         lLR = dict['lLR'] / .082 * 100
181
         lLR = dict['lLR'] / .082 * 100
207
         lUD = dict['lUD'] / .082 * 100 - 20 / 80
182
         lUD = dict['lUD'] / .082 * 100 - 20 / 80
208
         rLR = dict['rLR'] / .082 * 100 - 20 / 80
183
         rLR = dict['rLR'] / .082 * 100 - 20 / 80
209
         rUD = dict['rUD'] / .082 * 100 - 20 / 80
184
         rUD = dict['rUD'] / .082 * 100 - 20 / 80
210
         lTrig = dict['lTrig'] / .082 * 100 - 20 / 80
185
         lTrig = dict['lTrig'] / .082 * 100 - 20 / 80
211
         rTrig = dict['rTrig'] / .082 * 100 - 20 / 80
186
         rTrig = dict['rTrig'] / .082 * 100 - 20 / 80
212
-#        lBump = dict['lBump']
213
-#        rBump = dict['rBump']
214
-        
187
+
215
         if lLR < -20:
188
         if lLR < -20:
216
-            lmLR = round((lLR + 20) / 80 * 100, 0) 
189
+            lmLR = round((lLR + 20) / 80 * 100, 0)
217
         elif lLR > 20:
190
         elif lLR > 20:
218
             lmLR = round((lLR - 20) / 80 * 100, 0)
191
             lmLR = round((lLR - 20) / 80 * 100, 0)
219
-        else: lmLR = 0  
220
-              
192
+        else: lmLR = 0
193
+
221
         if lUD > 20:
194
         if lUD > 20:
222
             lmUD = round((lUD - 20) / 80 * 100, 0)
195
             lmUD = round((lUD - 20) / 80 * 100, 0)
223
         elif lUD < -20:
196
         elif lUD < -20:
224
             lmUD = round((lUD + 20) / 80 * 100, 0)
197
             lmUD = round((lUD + 20) / 80 * 100, 0)
225
-        else: lmUD = 0 
198
+        else: lmUD = 0
226
 
199
 
227
         if rLR < -20:
200
         if rLR < -20:
228
             rmLR = round((rLR + 20) / 80 * 100, 0)
201
             rmLR = round((rLR + 20) / 80 * 100, 0)
229
         elif rLR > 20:
202
         elif rLR > 20:
230
             rmLR = round((rLR - 20) / 80 * 100, 0)
203
             rmLR = round((rLR - 20) / 80 * 100, 0)
231
-        else: rmLR = 0         
232
-        
204
+        else: rmLR = 0
205
+
233
         if rUD > 20:
206
         if rUD > 20:
234
             rmUD = round((rUD - 20) / 80 * 100, 0)
207
             rmUD = round((rUD - 20) / 80 * 100, 0)
235
         elif rUD < -20:
208
         elif rUD < -20:
236
             rmUD = round((rUD + 20) / 80 * 100, 0)
209
             rmUD = round((rUD + 20) / 80 * 100, 0)
237
-        else: rmUD = 0 
238
-      
210
+        else: rmUD = 0
211
+
239
         if lTrig > 3:
212
         if lTrig > 3:
240
             mTrig = lTrig * -1
213
             mTrig = lTrig * -1
241
         elif rTrig > 3:
214
         elif rTrig > 3:
242
-            mTrig = rTrig    
215
+            mTrig = rTrig
243
         else: mTrig = 0
216
         else: mTrig = 0
244
 
217
 
245
         #move camera
218
         #move camera
249
         move_x = lmUD * mult
222
         move_x = lmUD * mult
250
         move_y = lmLR * mult
223
         move_y = lmLR * mult
251
         move_z = (mTrig * -mult) / 2#4
224
         move_z = (mTrig * -mult) / 2#4
252
-        
225
+
253
         rot_mult = -.00015 * own['speed_mult']
226
         rot_mult = -.00015 * own['speed_mult']
254
         rot_x = rmUD * rot_mult
227
         rot_x = rmUD * rot_mult
255
         rot_y = rmLR * rot_mult
228
         rot_y = rmLR * rot_mult
256
-        
229
+
257
         if move_x == 0 and own['last_move_x'] != 0:
230
         if move_x == 0 and own['last_move_x'] != 0:
258
             move_x = own['last_move_x'] * damping
231
             move_x = own['last_move_x'] * damping
259
         if move_y == 0 and own['last_move_y'] != 0:
232
         if move_y == 0 and own['last_move_y'] != 0:
260
-            move_y = own['last_move_y'] * damping 
233
+            move_y = own['last_move_y'] * damping
261
         if move_z == 0 and own['last_move_z'] != 0:
234
         if move_z == 0 and own['last_move_z'] != 0:
262
-            move_z = own['last_move_z'] * damping         
235
+            move_z = own['last_move_z'] * damping
263
         if rot_x == 0 and own['last_rot_x'] != 0:
236
         if rot_x == 0 and own['last_rot_x'] != 0:
264
             rot_x = own['last_rot_x'] * damping
237
             rot_x = own['last_rot_x'] * damping
265
         if rot_y == 0 and own['last_rot_y'] != 0:
238
         if rot_y == 0 and own['last_rot_y'] != 0:
266
-            rot_y = own['last_rot_y'] * damping         
267
-                             
239
+            rot_y = own['last_rot_y'] * damping
240
+
268
         move = [move_y, 0, move_x]
241
         move = [move_y, 0, move_x]
269
-        freecam.applyMovement( move, True)
270
-        freecam.applyMovement([0, 0, move_z], False)    
271
-        freecam.applyRotation([rot_x, 0, 0],True)
272
-        freecam.applyRotation([0, 0, rot_y],False)
273
-       
274
-        
275
-################    
276
-    #print(dict['walk'], 'walk')
242
+        freecam.applyMovement(move, True)
243
+        freecam.applyMovement([0, 0, move_z], False)
244
+        freecam.applyRotation([rot_x, 0, 0], True)
245
+        freecam.applyRotation([0, 0, rot_y], False)
246
+
247
+
248
+################
277
     multer = .02
249
     multer = .02
278
-    if dict['walk'] == 1 and controlcube['ragdoll_active'] == False:
250
+    if dict['walk'] == 1 and not controlcube['ragdoll_active']:
279
         if dict['cur_ccH_targetHeight'] < dict['cam_walk_height']:
251
         if dict['cur_ccH_targetHeight'] < dict['cam_walk_height']:
280
             dist = dict['cam_walk_height'] - dict['cur_ccH_targetHeight']
252
             dist = dict['cam_walk_height'] - dict['cur_ccH_targetHeight']
281
-            
253
+
282
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
254
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
283
             if dict['cur_ccH_targetHeight'] > dict['cam_walk_height']:
255
             if dict['cur_ccH_targetHeight'] > dict['cam_walk_height']:
284
                 dict['cur_ccH_targetHeight'] = dict['cam_walk_height']
256
                 dict['cur_ccH_targetHeight'] = dict['cam_walk_height']
285
-                
286
-        cam.min = dict['cam_walk_min'] 
287
-        cam.max = dict['cam_walk_max'] 
288
 
257
 
289
-        #print('walk cam')       
290
-        #ccH_targetHeight = .9
291
-    else:  
258
+        cam.min = dict['cam_walk_min']
259
+        cam.max = dict['cam_walk_max']
260
+
261
+    else:
292
 
262
 
293
         if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight']:
263
         if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight']:
294
             dist = dict['cur_ccH_targetHeight'] - dict['cch_targetHeight']
264
             dist = dict['cur_ccH_targetHeight'] - dict['cch_targetHeight']
295
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] - (dist * multer)
265
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] - (dist * multer)
296
             if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight'] - .001:
266
             if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight'] - .001:
297
-                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']             
267
+                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']
298
 
268
 
299
         if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight']:
269
         if dict['cur_ccH_targetHeight'] > dict['cch_targetHeight']:
300
-            dist = dict['cch_targetHeight'] - dict['cur_ccH_targetHeight'] 
270
+            dist = dict['cch_targetHeight'] - dict['cur_ccH_targetHeight']
301
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
271
             dict['cur_ccH_targetHeight'] = dict['cur_ccH_targetHeight'] + (dist * multer)
302
             if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight'] + .001:
272
             if dict['cur_ccH_targetHeight'] < dict['cch_targetHeight'] + .001:
303
-                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']             
304
-        
305
-        
306
-    ccH_targetHeight = dict['cur_ccH_targetHeight']  
307
-    #print(dict['cur_ccH_targetHeight'])    
308
-    #dict['cur_ccH_targetHeight'] =            
309
-    #ccH_targetHeight = .3
273
+                dict['cur_ccH_targetHeight'] = dict['cch_targetHeight']
274
+
275
+
276
+    ccH_targetHeight = dict['cur_ccH_targetHeight']
277
+
310
     ccH = camCube.worldPosition.z
278
     ccH = camCube.worldPosition.z
311
     pH = camCube.parent.worldPosition.z
279
     pH = camCube.parent.worldPosition.z
312
     ccheight = (round((ccH - pH), 2) - .4)
280
     ccheight = (round((ccH - pH), 2) - .4)
313
-    #print(ccheight, 'camera target height')
314
-    
281
+
315
     localPos = camCube.localPosition.z
282
     localPos = camCube.localPosition.z
316
-    #print(localPos, 'local position')
317
     if localPos != ccH_targetHeight:
283
     if localPos != ccH_targetHeight:
318
         num = ccH_targetHeight - localPos
284
         num = ccH_targetHeight - localPos
319
         camCube.localPosition.z += num
285
         camCube.localPosition.z += num
320
     #if camHeightSet not in own:
286
     #if camHeightSet not in own:
321
-    if 1 == 1:    
287
+    if 1 == 1:
322
         num = ccH_targetHeight - ccheight
288
         num = ccH_targetHeight - ccheight
323
     else:
289
     else:
324
-        own['camHeightSet'] = True    
325
-    try:       
290
+        own['camHeightSet'] = True
291
+    try:
326
         if dict['npause'] == False and controlcube['ragdoll_active'] == False:
292
         if dict['npause'] == False and controlcube['ragdoll_active'] == False:
327
-            cont.activate(own.actuators['Camera']) 
328
-            controlcube['camera'] = 0    
293
+            cont.activate(own.actuators['Camera'])
294
+            controlcube['camera'] = 0
329
         if controlcube['ragdoll_active'] == True:
295
         if controlcube['ragdoll_active'] == True:
330
             #print('ragdoll_camera', own.actuators['Camera'].object)
296
             #print('ragdoll_camera', own.actuators['Camera'].object)
331
             own.actuators['Camera'].object = scene.objects['ragdoll_parent']
297
             own.actuators['Camera'].object = scene.objects['ragdoll_parent']
332
-            cont.activate(own.actuators['Camera']) 
298
+            cont.activate(own.actuators['Camera'])
333
             controlcube['camera'] = 0
299
             controlcube['camera'] = 0
334
     except:
300
     except:
335
         pass
301
         pass
337
     cur_lens = cam1.lens
303
     cur_lens = cam1.lens
338
     cur_min = cam.min
304
     cur_min = cam.min
339
     cur_max = cam.max
305
     cur_max = cam.max
340
-    #print(cur_lens)
341
     inc = .025
306
     inc = .025
342
     if walk == 1:
307
     if walk == 1:
343
         #lens
308
         #lens
345
             new_lens = cur_lens + inc
310
             new_lens = cur_lens + inc
346
         else:
311
         else:
347
             new_lens = cur_lens - inc
312
             new_lens = cur_lens - inc
348
-        if cur_lens  > (dict['walk_focal_length'] - .1) and cur_lens  < (dict['walk_focal_length'] + .1):
349
-            new_lens = dict['walk_focal_length']  
350
-            
351
-        #distance      
352
-        inc = .025   
313
+        if cur_lens > (dict['walk_focal_length'] - .1) and cur_lens < (dict['walk_focal_length'] + .1):
314
+            new_lens = dict['walk_focal_length']
315
+
316
+        #distance
317
+        inc = .025
353
         if cur_min > (dict['cam_walk_min'] - inc):
318
         if cur_min > (dict['cam_walk_min'] - inc):
354
             new_min = cur_min - inc
319
             new_min = cur_min - inc
355
         if cur_min < (dict['cam_walk_min'] + inc):
320
         if cur_min < (dict['cam_walk_min'] + inc):
356
-            new_min = cur_min + inc 
321
+            new_min = cur_min + inc
357
         if cur_max > (dict['cam_walk_max'] - inc):
322
         if cur_max > (dict['cam_walk_max'] - inc):
358
             new_max = cur_min - inc
323
             new_max = cur_min - inc
359
         if cur_max < (dict['cam_walk_max'] + inc):
324
         if cur_max < (dict['cam_walk_max'] + inc):
360
-            new_max = cur_min + inc           
325
+            new_max = cur_min + inc
361
     else:
326
     else:
362
         #lens
327
         #lens
363
         if dict['focal_length'] > cur_lens:
328
         if dict['focal_length'] > cur_lens:
364
             new_lens = cur_lens + inc
329
             new_lens = cur_lens + inc
365
         else:
330
         else:
366
-            new_lens = cur_lens - inc 
367
-        if cur_lens  > (dict['focal_length'] - .1) and cur_lens  < (dict['focal_length'] + .1):
368
-            new_lens = dict['focal_length'] 
369
-            
370
-        #distance  
371
-        inc = .025   
331
+            new_lens = cur_lens - inc
332
+        if cur_lens > (dict['focal_length'] - .1) and cur_lens < (dict['focal_length'] + .1):
333
+            new_lens = dict['focal_length']
334
+
335
+        #distance
336
+        inc = .025
372
         if cur_min > (dict['cam_min'] - inc):
337
         if cur_min > (dict['cam_min'] - inc):
373
             new_min = cur_min - inc
338
             new_min = cur_min - inc
374
         if cur_min < (dict['cam_min'] + inc):
339
         if cur_min < (dict['cam_min'] + inc):
375
-            new_min = cur_min + inc 
340
+            new_min = cur_min + inc
376
         if cur_max > (dict['cam_max'] - inc):
341
         if cur_max > (dict['cam_max'] - inc):
377
             new_max = cur_min - inc
342
             new_max = cur_min - inc
378
         if cur_max < (dict['cam_max'] + inc):
343
         if cur_max < (dict['cam_max'] + inc):
379
-            new_max = cur_min + inc        
380
-            
381
-        
382
-            
383
-                                         
384
-        
344
+            new_max = cur_min + inc
345
+
385
     focallength = new_lens
346
     focallength = new_lens
386
     cam1.lens = focallength
347
     cam1.lens = focallength
387
     cam2.lens = focallength
348
     cam2.lens = focallength
388
     cam3.lens = focallength
349
     cam3.lens = focallength
389
     try:
350
     try:
390
         cam.min = new_min
351
         cam.min = new_min
391
-        cam.max = new_max  
392
-        #print(new_min, new_max)     
352
+        cam.max = new_max
393
     except:
353
     except:
394
-        pass    
395
-    
396
-                    
397
-#main()
354
+        pass

+ 2
- 2
shuvit.blend View File

1
 version https://git-lfs.github.com/spec/v1
1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:bdeaa0427d6e0e146db9c836a1d79536092099f6776c06faae6236b91d1c00fd
3
-size 144952188
2
+oid sha256:146e177ff6c51f8476150c3ae08c0df75f7274c9893e79a4fbab99622939c07f
3
+size 145082860

Loading…
Cancel
Save