shuvit 6 years ago
parent
commit
4c9d20f3a8
3 changed files with 42 additions and 27 deletions
  1. 1
    1
      co_ActionState.py
  2. 2
    2
      controller2.py
  3. 39
    24
      grindV2.py

+ 1
- 1
co_ActionState.py View File

54
     if own['actionTimer'] != 0 and transPlaying == False and isplaying == False:
54
     if own['actionTimer'] != 0 and transPlaying == False and isplaying == False:
55
         own['actionTimer'] = 0
55
         own['actionTimer'] = 0
56
         actionTimer = 0
56
         actionTimer = 0
57
-        print('reset actionTimer')
57
+        #print('reset actionTimer')
58
         #pass 
58
         #pass 
59
         
59
         
60
 #    if own['actionTimer'] != 0:
60
 #    if own['actionTimer'] != 0:

+ 2
- 2
controller2.py View File

3483
         if own['invert_on'] == 1 and own['last_invert'] == False:
3483
         if own['invert_on'] == 1 and own['last_invert'] == False:
3484
             #killall()
3484
             #killall()
3485
             cont.activate(own.actuators['invertOn_sound'])
3485
             cont.activate(own.actuators['invertOn_sound'])
3486
-            if STANCE == True:
3486
+            if STANCE == False:
3487
                 own['invert_type'] = "reg_back_invert_in"
3487
                 own['invert_type'] = "reg_back_invert_in"
3488
             #     skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3488
             #     skater.playAction("reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3489
             #     deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
3489
             #     deck.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1)
3490
             #     trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3490
             #     trucks.playAction("a_reg_back_invert_in", 10,30, layer=303, play_mode=0, speed=1) 
3491
-            if STANCE == False:
3491
+            if STANCE == True:
3492
                 own['invert_type'] = "fak_fr_invert"
3492
                 own['invert_type'] = "fak_fr_invert"
3493
             #     skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1) 
3493
             #     skater.playAction("fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1) 
3494
             #     deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)
3494
             #     deck.playAction("a_fak_fr_invert", 10,30, layer=303, play_mode=0, speed=1)

+ 39
- 24
grindV2.py View File

43
     #print(roty)
43
     #print(roty)
44
     roty = abs(roty) 
44
     roty = abs(roty) 
45
     sub = 0
45
     sub = 0
46
-    align_strength = 1
46
+    align_strength = .4
47
     align_strength2 = .3
47
     align_strength2 = .3
48
     touched = grindTouch.triggered
48
     touched = grindTouch.triggered
49
     lgf = own['last_grind_frame']
49
     lgf = own['last_grind_frame']
218
 
218
 
219
 
219
 
220
         if rot >= 45 and rot < 90:  
220
         if rot >= 45 and rot < 90:  
221
-            #90 degrees CW about z-axis: (x, y, z) -> (y, -x, z)                 
222
-            player.alignAxisToVect(grinder_vect, 0, align_strength) 
221
+            #90 degrees CW about z-axis: (x, y, z) -> (y, -x, z)
222
+            #90 degrees CCW about z-axis: (x, y, z) -> (-y, x, z) 
223
+            #grinder_vect2 =                 
224
+            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, grinder_vect.z], 0, align_strength)
225
+            #print("1") 
223
             grindvect = "pos"
226
             grindvect = "pos"
224
-            player.applyRotation(bsrot, 1)
227
+            #player.applyRotation(bsrot, 1)
225
             align = "pos"
228
             align = "pos"
226
             #player.applyForce([0, 0, 0], True)
229
             #player.applyForce([0, 0, 0], True)
227
             player.setLinearVelocity([0, convely, zvel], 1)   
230
             player.setLinearVelocity([0, convely, zvel], 1)   
231
             #print("boardslide")
234
             #print("boardslide")
232
                            
235
                            
233
         if rot >= 90 and rot < 135:  
236
         if rot >= 90 and rot < 135:  
234
-            #print(STANCE, "2")                 
235
-            player.alignAxisToVect(-grinder_vect, 0, align_strength) 
237
+            #print(STANCE, "2") 
238
+            grinder_vect = grinder_vect * -1                
239
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, grinder_vect.z], 0, align_strength) 
236
             grindvect = "neg"
240
             grindvect = "neg"
237
-            player.applyRotation(negbsrot, 1)
241
+            #print("2")
242
+            #player.applyRotation(negbsrot, 1)
238
             align = "neg"
243
             align = "neg"
239
             grindyvect = "neg"
244
             grindyvect = "neg"
240
             #player.applyForce([0, 0, 0], True)
245
             #player.applyForce([0, 0, 0], True)
259
             
264
             
260
         if rot >= 225 and rot < 270:
265
         if rot >= 225 and rot < 270:
261
             #print(STANCE, "3")
266
             #print(STANCE, "3")
262
-            player.alignAxisToVect(-grinder_vect, 0, align_strength)
267
+            #grinder_vect = grinder_vect * -1
268
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, grinder_vect.z], 0, align_strength)
269
+            #print("3")
263
             grindvect = "neg"
270
             grindvect = "neg"
264
-            player.applyRotation(bsrot, 1)
271
+            #player.applyRotation(bsrot, 1)
265
             align = "pos"
272
             align = "pos"
266
             #player.applyForce([0, 0, 0], True)
273
             #player.applyForce([0, 0, 0], True)
267
             player.setLinearVelocity([0, convely, zvel], 1)
274
             player.setLinearVelocity([0, convely, zvel], 1)
272
            
279
            
273
         if rot >= 270 and rot < 315:
280
         if rot >= 270 and rot < 315:
274
             #print(STANCE, "4")
281
             #print(STANCE, "4")
275
-            player.alignAxisToVect(grinder_vect, 0, align_strength) 
282
+            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, grinder_vect.z], 0, align_strength) 
276
             grindvect = "pos"
283
             grindvect = "pos"
277
-            player.applyRotation(negbsrot, 1)  
284
+            #player.applyRotation(negbsrot, 1)
285
+            #print("4")  
278
             align = "neg"
286
             align = "neg"
279
             #player.applyForce([0, 0, 0], True)
287
             #player.applyForce([0, 0, 0], True)
280
             player.setLinearVelocity([0, convely, zvel], 1)
288
             player.setLinearVelocity([0, convely, zvel], 1)
300
                                   
308
                                   
301
         if rot < -45 and rot >= -90:
309
         if rot < -45 and rot >= -90:
302
             #print(STANCE, "5")
310
             #print(STANCE, "5")
303
-            player.alignAxisToVect(grinder_vect, 0, align_strength)
311
+            grinder_vect = grinder_vect * -1
312
+            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, grinder_vect.z], 0, align_strength)
304
             grindvect = "pos"
313
             grindvect = "pos"
305
-            player.applyRotation(negbsrot, 1)
314
+            #player.applyRotation(negbsrot, 1)
315
+            #print("5")
306
             align = "neg"
316
             align = "neg"
307
             #player.applyForce([0, 0, 0], True)
317
             #player.applyForce([0, 0, 0], True)
308
             player.setLinearVelocity([0, convely, zvel], 1)
318
             player.setLinearVelocity([0, convely, zvel], 1)
313
             grindyvect = "neg"
323
             grindyvect = "neg"
314
         if rot < -90 and rot >= -135:
324
         if rot < -90 and rot >= -135:
315
             #print(STANCE, "6")
325
             #print(STANCE, "6")
316
-            player.alignAxisToVect(-grinder_vect, 0, align_strength) 
326
+            #grinder_vect = grinder_vect * -1
327
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, grinder_vect.z], 0, align_strength) 
317
             grindvect = "neg"
328
             grindvect = "neg"
318
-            player.applyRotation(bsrot, 1)
329
+            #print("6")
330
+            #player.applyRotation(bsrot, 1)
319
             align = "pos"
331
             align = "pos"
320
             #player.applyForce([0, 0, 0], True)
332
             #player.applyForce([0, 0, 0], True)
321
             player.setLinearVelocity([0, convely, zvel], 1)
333
             player.setLinearVelocity([0, convely, zvel], 1)
339
             grindpos = "reg_5050" 
351
             grindpos = "reg_5050" 
340
         if rot < -225 and rot >= -270:
352
         if rot < -225 and rot >= -270:
341
             #print(STANCE, "7")
353
             #print(STANCE, "7")
342
-            player.alignAxisToVect(-grinder_vect, 0, align_strength) 
354
+            grinder_vect = grinder_vect * -1
355
+            player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, grinder_vect.z], 0, align_strength) 
343
             grindvect = "neg"
356
             grindvect = "neg"
344
-            player.applyRotation(negbsrot, 1)
357
+            #player.applyRotation(negbsrot, 1)
358
+            #print("7")
345
             align = "neg"
359
             align = "neg"
346
             #player.applyForce([0, 0, 0], True)
360
             #player.applyForce([0, 0, 0], True)
347
             player.setLinearVelocity([0, convely, zvel], 1)
361
             player.setLinearVelocity([0, convely, zvel], 1)
351
             #print("boardslide")            
365
             #print("boardslide")            
352
         if rot < -270 and rot >= -315:
366
         if rot < -270 and rot >= -315:
353
             #print(STANCE, "8")
367
             #print(STANCE, "8")
354
-            player.alignAxisToVect(grinder_vect, 0, align_strength) 
368
+            player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, grinder_vect.z], 0, align_strength) 
355
             grindvect = "pos"
369
             grindvect = "pos"
356
-            player.applyRotation(bsrot, 1)
370
+            #player.applyRotation(bsrot, 1)
371
+            #print("8")
357
             align = "pos"
372
             align = "pos"
358
             #player.applyForce([0, 0, 0], True)
373
             #player.applyForce([0, 0, 0], True)
359
             player.setLinearVelocity([0, convely, zvel], 1)
374
             player.setLinearVelocity([0, convely, zvel], 1)
570
             hitObject, hitPoint, hitNormal = own.rayCast(nearestObject.worldPosition, own.worldPosition, .0, 'grind')
585
             hitObject, hitPoint, hitNormal = own.rayCast(nearestObject.worldPosition, own.worldPosition, .0, 'grind')
571
             if grindold == 0:
586
             if grindold == 0:
572
                 if grindTouch.positive:
587
                 if grindTouch.positive:
573
-                    print("set grind pos")
588
+                    #print("set grind pos")
574
                     nearpos = nearestObject.worldPosition
589
                     nearpos = nearestObject.worldPosition
575
                     if hitNormal != None:
590
                     if hitNormal != None:
576
-                        own.alignAxisToVect(hitNormal, 2, 1) 
591
+                        own.alignAxisToVect(hitNormal, 2, .05) 
577
                         print("align")                   
592
                         print("align")                   
578
-                    #own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
579
-                    print("setting pos")
593
+                    own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
594
+                    #print("setting pos")
580
             
595
             
581
             #if hitNormal != None:
596
             #if hitNormal != None:
582
                 #own.alignAxisToVect(hitNormal, 2, .4)
597
                 #own.alignAxisToVect(hitNormal, 2, .4)
592
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
607
             grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
593
             #print(grind_height_dif)
608
             #print(grind_height_dif)
594
             worldPos = own.worldPosition
609
             worldPos = own.worldPosition
595
-            if grind_height_dif > -.02:
610
+            if grind_height_dif > -.02:#02:
596
                 #print("############################upping z")
611
                 #print("############################upping z")
597
                 #own.worldPosition = [worldPos.x, worldPos.y, worldPos.z + .1]
612
                 #own.worldPosition = [worldPos.x, worldPos.y, worldPos.z + .1]
598
 
613
 

Loading…
Cancel
Save