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,11 +1811,6 @@ def main():
1811 1811
             wheel3.playAction("roll2.001", 20,1, layer=2, play_mode=1, speed=2)
1812 1812
             wheel4.playAction("roll3.001", 20,1, layer=2, play_mode=1, speed=2)
1813 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 1815
     def turn():   
1821 1816
         #rotamt = .02
@@ -2628,10 +2623,10 @@ def main():
2628 2623
     air() 
2629 2624
     stance()
2630 2625
     turn()
2631
-    rotmult()
2626
+    #rotmult()
2632 2627
     airup()
2633 2628
     onramp()
2634
-    speedmult()
2629
+    #speedmult()
2635 2630
     coping()
2636 2631
     resetjumpstance()
2637 2632
     grass()
@@ -4304,7 +4299,7 @@ def main():
4304 4299
     onboard()   
4305 4300
     #wallhit() 
4306 4301
     linvelx = own.getLinearVelocity(True)
4307
-    land_boost()
4302
+    #land_boost()
4308 4303
     own["linvelx"] = linvelx.x
4309 4304
     LAST_STANCE = STANCE
4310 4305
     LAST_STANCE = own["stance"]
@@ -4344,7 +4339,32 @@ def main():
4344 4339
 
4345 4340
     if r_ground.triggered and own["jump_timer"] < 20:
4346 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 4368
     if (grindDar == False and r_ground.triggered and own['grindTouch'] == False) or own['jump_timer'] > 40:
4349 4369
         own['grindType'] = ''
4350 4370
     

Loading…
Cancel
Save