Browse Source

grind corner aligns

shuvit 5 years ago
parent
commit
b12ffe6d35

BIN
scripts/__pycache__/controller2.cpython-36.pyc View File


BIN
scripts/__pycache__/grindV2.cpython-36.pyc View File


+ 12
- 5
scripts/controller2.py View File

4514
     localRay = groundRay
4514
     localRay = groundRay
4515
     own['vert'] = 0
4515
     own['vert'] = 0
4516
     own['transition'] = False
4516
     own['transition'] = False
4517
+    aligned = False
4517
     #if localRay[0] or grindRay[0]:
4518
     #if localRay[0] or grindRay[0]:
4518
     if localRay[0]:
4519
     if localRay[0]:
4519
 
4520
 
4540
             if localRay[2] != [0, 0, -1]:    
4541
             if localRay[2] != [0, 0, -1]:    
4541
                 #own.alignAxisToVect(localRay[2], 2, .25)
4542
                 #own.alignAxisToVect(localRay[2], 2, .25)
4542
                 own.alignAxisToVect(localRay[2], 2, .5)
4543
                 own.alignAxisToVect(localRay[2], 2, .5)
4544
+                aligned = True
4543
             #print('localRay')
4545
             #print('localRay')
4544
 
4546
 
4545
 
4547
 
4569
                         #print('moving new rayb')
4571
                         #print('moving new rayb')
4570
                         if localRay[2] != [0, 0, -1] and grindHit == 0:
4572
                         if localRay[2] != [0, 0, -1] and grindHit == 0:
4571
                             own.alignAxisToVect(localRay[2], 2, .25)
4573
                             own.alignAxisToVect(localRay[2], 2, .25)
4574
+                            aligned = True
4572
 
4575
 
4573
     else:
4576
     else:
4574
         #print('vh')
4577
         #print('vh')
4583
             localHitDist = Vector.copy(Start - localRay_v[1]).length
4586
             localHitDist = Vector.copy(Start - localRay_v[1]).length
4584
             own.linearVelocity.x *= .98
4587
             own.linearVelocity.x *= .98
4585
             own.linearVelocity.z = .1
4588
             own.linearVelocity.z = .1
4586
-            if localHitDist < .8 and (dict['lUD'] < .04 or dict['lUD'] > -.04):
4589
+            #if localHitDist < .8 and (dict['lUD'] < .04 or dict['lUD'] > -.04):
4590
+            if localHitDist < .8:    
4587
                 #own.applyMovement((0,0,((.4 - (localHitDist) * .1))), True)
4591
                 #own.applyMovement((0,0,((.4 - (localHitDist) * .1))), True)
4588
-                own.applyMovement((0, 0, (.287 - localHitDist)), True)
4592
+                own.applyMovement((0, 0, (.4 - localHitDist)), True)
4589
                 #print('moving vert ray')
4593
                 #print('moving vert ray')
4590
                 if localRay_v[2] != [0, 0, -1] and grindHit == 0:
4594
                 if localRay_v[2] != [0, 0, -1] and grindHit == 0:
4591
                 #if localRay_v[2] != [0,0,-1]:
4595
                 #if localRay_v[2] != [0,0,-1]:
4592
-                    own.alignAxisToVect(localRay_v[2], 2, .3)
4596
+                    own.alignAxisToVect(localRay_v[2], 2, .4)
4597
+                    aligned = True
4593
         #print(own['lGobj'], 'lGobj')                         
4598
         #print(own['lGobj'], 'lGobj')                         
4594
 
4599
 
4595
 
4600
 
4610
         if rayf[0]:
4615
         if rayf[0]:
4611
             print('rayf hit')
4616
             print('rayf hit')
4612
             own.alignAxisToVect(rayf[2], 2, .2)
4617
             own.alignAxisToVect(rayf[2], 2, .2)
4618
+            aligned = True
4613
         elif rayb[0]:
4619
         elif rayb[0]:
4614
             own.alignAxisToVect(rayb[2], 2, .2)
4620
             own.alignAxisToVect(rayb[2], 2, .2)
4621
+            aligned = True
4615
             print('rayb hit')
4622
             print('rayb hit')
4616
 
4623
 
4617
     #print(raytof, raytob)
4624
     #print(raytof, raytob)
4618
 
4625
 
4619
-
4620
-
4626
+    if not aligned:
4627
+        own.alignAxisToVect([0.0, 0.0, 1.0], 2, .03)
4621
 
4628
 
4622
     if own.linearVelocity.x > 12:
4629
     if own.linearVelocity.x > 12:
4623
         own.linearVelocity.x = 12
4630
         own.linearVelocity.x = 12

+ 8
- 19
scripts/grindV2.py View File

94
 
94
 
95
     if grindold == 1:
95
     if grindold == 1:
96
         no_grind = 0
96
         no_grind = 0
97
-    #don't grind unless you were in the air recently or were on a ramp recently or were grinding.
98
-
99
-    #if (own['onramp'] == 0 and frames_since_grind > 30):
100
-        #no_grind = 1
101
-
102
-    #if frames_since_grind > 30:
103
-        #no_grind = 0
104
 
97
 
105
     if frames_since_ground > 30 or since_jumped < 120:
98
     if frames_since_ground > 30 or since_jumped < 120:
106
         no_grind = 0
99
         no_grind = 0
107
     if jump_timer > 50:
100
     if jump_timer > 50:
108
         no_grind = 1
101
         no_grind = 1
109
-    if grindold == 0 and  (dict['lUD'] < -.04 or dict['lUD'] > .04):
110
-        no_grind = 1
111
-
112
-    #print('no grind timer', no_grind, own['no_grind_timer'])
113
-
114
 
102
 
115
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1):
103
     if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1):
116
         manual = 1
104
         manual = 1
117
     else:
105
     else:
118
         manual = 0
106
         manual = 0
119
-    #manual = own['manual']
107
+
120
     own["nogrindsound"] = 0
108
     own["nogrindsound"] = 0
121
     no_grind = 1
109
     no_grind = 1
122
-    if (dict['rBump'] == 1 or own['vert'] == 0):
123
-    #print(own['last_vert_frame'])
124
-    #if (dict['rBump'] == 1 or (framenum - own['last_vert_frame'] < 10) and own['vert'] == 0):
110
+    
111
+    if (framenum - own['last_vert_frame'] < 40) and own['vert'] == 0:
112
+        no_grind = 1
113
+        print('no_grind = 1 last vert = ', (framenum - own['last_vert_frame']))
114
+    if dict['rBump'] == 1:
125
         no_grind = 0
115
         no_grind = 0
126
-        #print('no_grind = 0')
116
+
127
     if own['LAST_GRIND']:
117
     if own['LAST_GRIND']:
128
         no_grind = 0
118
         no_grind = 0
129
-    # if (dict['lUD'] < -.04 or dict['lUD'] > .04):
130
-    #     no_grind = 0
119
+    
131
 #---------###########___###########-----------
120
 #---------###########___###########-----------
132
 #start new                     #######
121
 #start new                     #######
133
 ##----------##############----------############
122
 ##----------##############----------############

Loading…
Cancel
Save