Browse Source

lands n ragdoll things

shuvit 5 years ago
parent
commit
efb2564ca2
3 changed files with 62 additions and 79 deletions
  1. 1
    1
      config.ini
  2. 59
    76
      scripts/camera.py
  3. 2
    2
      shuvit.blend

+ 1
- 1
config.ini View File

@@ -33,7 +33,7 @@ recorder_on = 1
33 33
 #camera 
34 34
 #######
35 35
 cam_height = -0.4
36
-focal_length = 26
36
+focal_length = 10
37 37
 cam_min = 2.9
38 38
 cam_max = 5.0
39 39
 cch_targetHeight = 0.5

+ 59
- 76
scripts/camera.py View File

@@ -87,22 +87,7 @@ def main(cont):
87 87
             hitPosition = down.hitPosition
88 88
             distance = own.getDistanceTo(hitPosition)
89 89
             cam_moved = 1
90
-            # if 'vert' not in down.hitObject:
91
-            #     if distance < .2:
92
-            #         camempty['hitdown'] = True
93
-            #         cam.height = cam_height + .3
94
-            #         cam.damping = .0
95
-            #         print("raise cam")
96
-            #     if zdist < -.2:
97
-            #         cam.height = lastCamheight + .01
98
-            #         cam.damping = .0
99
-            #         raised = 1
100
-            #     if (distance > .4 and distance < .6) and zdist > -.2 and raised == 0:
101
-            #         camheight2 = cam.height - .001
102
-            #         if cam.height < .2:
103
-            #             cam.height = camheight2
104
-            #     if distance >= .6 and zdist > -.2 and raised == 0:
105
-            #         cam.height = cam.height - .02
90
+
106 91
         if down.triggered == False and LAST_GRIND == False and cam_moved == 0 and walk == 0:
107 92
             camempty['hitdown'] = False
108 93
             if cam_height > (cam_def_height + .06) and zdist > -.2 and raised == 0:
@@ -115,11 +100,6 @@ def main(cont):
115 100
             if cam.height >= -.5 and not down.triggered:
116 101
                 pass
117 102
 
118
-        if walk == 1:
119
-            if dropinCol.positive == True and lasty == True:
120
-                pass
121
-            else:
122
-                pass
123 103
         controlcube['lastCamheight'] = cam.height
124 104
         #activating######
125 105
         cont.activate(own.actuators['Camera'])
@@ -164,7 +144,8 @@ def main(cont):
164 144
         hitobj = str(hitobj)
165 145
         
166 146
         if hit[0]:
167
-            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:
148
+            if hitobj != control and walk == 0 and 'vert' not in hit[0] and 'ground' in hit[0]:
168 149
                 cam.damping = .0
169 150
                 if cam.height < 2:
170 151
                     cam.height = cam_height + .1
@@ -304,10 +285,10 @@ def main(cont):
304 285
         num = ccH_targetHeight - localPos
305 286
         camCube.localPosition.z += num
306 287
     #if camHeightSet not in own:
307
-    if 1 == 1:
308
-        num = ccH_targetHeight - ccheight
309
-    else:
310
-        own['camHeightSet'] = True
288
+    #if 1 == 1:
289
+    num = ccH_targetHeight - ccheight
290
+    #else:
291
+        #own['camHeightSet'] = True
311 292
     try:
312 293
         if dict['npause'] == False and controlcube['ragdoll_active'] == False:
313 294
             cont.activate(own.actuators['Camera'])
@@ -320,57 +301,59 @@ def main(cont):
320 301
     except:
321 302
         pass
322 303
 
323
-    cur_lens = cam1.lens
324
-    cur_min = cam.min
325
-    cur_max = cam.max
326
-    inc = .025
327
-    if walk == 1:
328
-        #lens
329
-        if dict['walk_focal_length'] > cur_lens:
330
-            new_lens = cur_lens + inc
331
-        else:
332
-            new_lens = cur_lens - inc
333
-        if cur_lens > (dict['walk_focal_length'] - .1) and cur_lens < (dict['walk_focal_length'] + .1):
334
-            new_lens = dict['walk_focal_length']
335
-
336
-        #distance
304
+    def set_lens_dist():
305
+        cur_lens = cam1.lens
306
+        cur_min = cam.min
307
+        cur_max = cam.max
337 308
         inc = .025
338
-        if cur_min > (dict['cam_walk_min'] - inc):
339
-            new_min = cur_min - inc
340
-        if cur_min < (dict['cam_walk_min'] + inc):
341
-            new_min = cur_min + inc
342
-        if cur_max > (dict['cam_walk_max'] - inc):
343
-            new_max = cur_min - inc
344
-        if cur_max < (dict['cam_walk_max'] + inc):
345
-            new_max = cur_min + inc
346
-    else:
347
-        #lens
348
-        if dict['focal_length'] > cur_lens:
349
-            new_lens = cur_lens + inc
309
+        if walk == 1:
310
+            #lens
311
+            if dict['walk_focal_length'] > cur_lens:
312
+                new_lens = cur_lens + inc
313
+            else:
314
+                new_lens = cur_lens - inc
315
+            if cur_lens > (dict['walk_focal_length'] - .1) and cur_lens < (dict['walk_focal_length'] + .1):
316
+                new_lens = dict['walk_focal_length']
317
+
318
+            #distance
319
+            inc = .025
320
+            if cur_min > (dict['cam_walk_min'] - inc):
321
+                new_min = cur_min - inc
322
+            if cur_min < (dict['cam_walk_min'] + inc):
323
+                new_min = cur_min + inc
324
+            if cur_max > (dict['cam_walk_max'] - inc):
325
+                new_max = cur_min - inc
326
+            if cur_max < (dict['cam_walk_max'] + inc):
327
+                new_max = cur_min + inc
350 328
         else:
351
-            new_lens = cur_lens - inc
352
-        if cur_lens > (dict['focal_length'] - .1) and cur_lens < (dict['focal_length'] + .1):
353
-            new_lens = dict['focal_length']
354
-
355
-        #distance
356
-        inc = .025
357
-        if cur_min > (dict['cam_min'] - inc):
358
-            new_min = cur_min - inc
359
-        if cur_min < (dict['cam_min'] + inc):
360
-            new_min = cur_min + inc
361
-        if cur_max > (dict['cam_max'] - inc):
362
-            new_max = cur_min - inc
363
-        if cur_max < (dict['cam_max'] + inc):
364
-            new_max = cur_min + inc
365
-
366
-    focallength = new_lens
367
-    cam1.lens = focallength
368
-    cam2.lens = focallength
369
-    cam3.lens = focallength
370
-    try:
371
-        cam.min = new_min
372
-        cam.max = new_max
373
-    except:
374
-        pass
329
+            #lens
330
+            if dict['focal_length'] > cur_lens:
331
+                new_lens = cur_lens + inc
332
+            else:
333
+                new_lens = cur_lens - inc
334
+            if cur_lens > (dict['focal_length'] - .1) and cur_lens < (dict['focal_length'] + .1):
335
+                new_lens = dict['focal_length']
336
+
337
+            #distance
338
+            inc = .025
339
+            if cur_min > (dict['cam_min'] - inc):
340
+                new_min = cur_min - inc
341
+            if cur_min < (dict['cam_min'] + inc):
342
+                new_min = cur_min + inc
343
+            if cur_max > (dict['cam_max'] - inc):
344
+                new_max = cur_min - inc
345
+            if cur_max < (dict['cam_max'] + inc):
346
+                new_max = cur_min + inc
347
+
348
+        focallength = new_lens
349
+        cam1.lens = focallength
350
+        cam2.lens = focallength
351
+        cam3.lens = focallength
352
+        try:
353
+            cam.min = new_min
354
+            cam.max = new_max
355
+        except:
356
+            pass
357
+    set_lens_dist()        
375 358
     get_cam_state()
376 359
     camFSM.main(cont)

+ 2
- 2
shuvit.blend View File

@@ -1,3 +1,3 @@
1 1
 version https://git-lfs.github.com/spec/v1
2
-oid sha256:25104724a66fbae95b6511ec52b9b86f2472fca54ff98ba8612bdda6be2b8b29
3
-size 142303020
2
+oid sha256:b5d9476674014b29a9f15cb2d711e524272ca1653b75767b367bda0e5420f7f1
3
+size 143780392

Loading…
Cancel
Save