Browse Source

glitchy ray collision

shuvit 5 years ago
parent
commit
397a6cf14e
1 changed files with 29 additions and 9 deletions
  1. 29
    9
      scripts/controller2.py

+ 29
- 9
scripts/controller2.py View File

1811
             wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
1811
             wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
1812
             wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
1812
             wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
1813
             wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2) 
1813
             wheel1.playAction("roll4.001", 20,1, layer=2, play_mode=1, speed=2) 
1814
-
1815
-    def transspeed():
1816
-        num1 = .1
1817
-        num2 = .4
1818
-        speed = 20
1819
         
1814
         
1820
     def turn():   
1815
     def turn():   
1821
         #rotamt = .02
1816
         #rotamt = .02
2628
     air() 
2623
     air() 
2629
     stance()
2624
     stance()
2630
     turn()
2625
     turn()
2631
-    rotmult()
2626
+    #rotmult()
2632
     airup()
2627
     airup()
2633
     onramp()
2628
     onramp()
2634
-    speedmult()
2629
+    #speedmult()
2635
     coping()
2630
     coping()
2636
     resetjumpstance()
2631
     resetjumpstance()
2637
     grass()
2632
     grass()
4304
     onboard()   
4299
     onboard()   
4305
     #wallhit() 
4300
     #wallhit() 
4306
     linvelx = own.getLinearVelocity(True)
4301
     linvelx = own.getLinearVelocity(True)
4307
-    land_boost()
4302
+    #land_boost()
4308
     own["linvelx"] = linvelx.x
4303
     own["linvelx"] = linvelx.x
4309
     LAST_STANCE = STANCE
4304
     LAST_STANCE = STANCE
4310
     LAST_STANCE = own["stance"]
4305
     LAST_STANCE = own["stance"]
4344
 
4339
 
4345
     if r_ground.triggered and own["jump_timer"] < 20:
4340
     if r_ground.triggered and own["jump_timer"] < 20:
4346
         force2 = [0.0, 0, dict['antibounce']]
4341
         force2 = [0.0, 0, dict['antibounce']]
4347
-        own.applyForce(force2, True)
4342
+        #own.applyForce(force2, True)
4343
+
4344
+        gdist = ((own.worldPosition.z - r_ground.hitPosition[2]))  
4345
+        #print(gdist)
4346
+        if gdist < .2875 and gdist > .1:
4347
+            #move = 2.875 - gdist
4348
+            move = (.2875 - gdist)*.5
4349
+            #move = (own.worldPosition.z + gdist)
4350
+            if move > 0:
4351
+                own.worldPosition.z = own.worldPosition.z + move
4352
+            else:
4353
+                own.worldPosition.z = own.worldPosition.z - move    
4354
+            own.linearVelocity.z = 0
4355
+            #f3 = own.force
4356
+            #own.force.z = 0
4357
+            #print(move, own.worldPosition.z)
4358
+            #own.applyForce([0,0,0], True)
4359
+            print(gdist, 'gdist', move)
4360
+            #aligner = getAxisVect([r_ground.hitPosition])
4361
+            vectTo = own.getVectTo(r_ground.hitPosition)
4362
+            own.alignAxisToVect(-vectTo[2], 2, .5)
4363
+
4364
+    #print(own.worldPosition.z, 'wp')
4365
+
4366
+    if own.linearVelocity.x > 10:
4367
+        own.linearVelocity.x = 10
4348
     if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
4368
     if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
4349
         own['grindType'] = ''
4369
         own['grindType'] = ''
4350
     
4370
     

Loading…
Cancel
Save