shuvit 6 years ago
parent
commit
1bd6c87f88
4 changed files with 81 additions and 49 deletions
  1. 1
    1
      co_ActionState.py
  2. 20
    4
      controller2.py
  3. 16
    0
      grindV2.py
  4. 44
    44
      walk.py

+ 1
- 1
co_ActionState.py View File

@@ -2853,7 +2853,7 @@ def main():
2853 2853
     trans_playing = skater.isPlayingAction(trans_layer)
2854 2854
     if trans_playing:
2855 2855
         cur_frame = skater.getActionFrame(trans_layer)       
2856
-    print("rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
2856
+    #print("rA:", requestAction, "|aS:", own['actionState'], "q", queueAction, own['actionTimer'], 'cf', cur_frame)
2857 2857
     cur_frame = skater.getActionFrame(trans_layer)
2858 2858
     #print(cur_frame)
2859 2859
     def printplaying():

+ 20
- 4
controller2.py View File

@@ -2191,11 +2191,13 @@ def main():
2191 2191
                 if own['dropinCol'] == True:
2192 2192
                     print("dropinanim")
2193 2193
                     own['requestAction'] = 'reg_dropin'
2194
+                    own['dropinTimer'] = 60
2194 2195
                 else:
2195 2196
                     own['requestAction'] = 'reg_onboard'    
2196
-                force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
2197
-                own.setLinearVelocity(force, True)
2198
-                own['dropinTimer'] = 60
2197
+                    force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
2198
+                    if own['dropinTimer'] == 0:
2199
+                        own.setLinearVelocity(force, True)
2200
+                        print('onboard vel')
2199 2201
             if STANCE == 1:
2200 2202
                 skater.stopAction(fliplay)
2201 2203
                 deck.stopAction(fliplay)
@@ -3987,7 +3989,20 @@ def main():
3987 3989
         else:
3988 3990
             own['air_mover'] = False 
3989 3991
             
3990
-            
3992
+    def dropinRotate():
3993
+        if own['dropinTimer'] > 35 and own['dropinTimer'] < 45:
3994
+            # rotate the game object 1.570796327 radians (90 degrees) 
3995
+            rot = [ 0.01, 0.0, 0]
3996
+            # use the world axis
3997
+            local = True
3998
+            # apply rotation
3999
+            own.applyRotation(rot,local)
4000
+            print('dropin rotate')
4001
+        if own['dropinTimer'] == 45:
4002
+            #linVelocity = own.getlinearVelocity
4003
+            force = (linVelocity.x -1, linVelocity.y, linVelocity.z)
4004
+            own.setLinearVelocity(force, True)
4005
+            print('dropin vel')                
3991 4006
 
3992 4007
     framenum = own['framenum']
3993 4008
     last_ground_frame = own['lF_ground_frame']
@@ -4014,6 +4029,7 @@ def main():
4014 4029
     shutoff_timers()
4015 4030
     grindout_cleanup()
4016 4031
     air_mover()
4032
+    dropinRotate()    
4017 4033
     linvelx = own.getLinearVelocity(True)
4018 4034
 
4019 4035
     own["linvelx"] = linvelx.x

+ 16
- 0
grindV2.py View File

@@ -640,6 +640,22 @@ def main():
640 640
             own['aligntimer'] = own['aligntimer'] - 1
641 641
         if own['grindOld'] == 0 and ray.triggered == 0:
642 642
             own['aligntimer'] = 0   
643
+
644
+    def invertpos():
645
+        minDist = None
646
+        nearestObject = None
647
+        for obj in invertObjs:
648
+            dist = own.getDistanceTo(obj)
649
+            if (minDist is None or dist < minDist):
650
+                nearestObject = obj
651
+                minDist = dist
652
+        vect = nearestObject.getAxisVect( [1.0, 0.0, 0.0])
653
+        #own.alignAxisToVect(vect, 0, 0)
654
+        own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
655
+       #own.setLinearVelocity([0, 0.0, 0], 1)                    
656
+
657
+
658
+
643 659
             
644 660
     def set_pregrind_vel():
645 661
         if grindDar.triggered == False and ray.triggered == False:

+ 44
- 44
walk.py View File

@@ -621,50 +621,50 @@ def getonboard():
621 621
         fliplay3 = fliplay2 + 1 
622 622
         if dropinCol.positive == True: 
623 623
                        
624
-#            nearestObject = None
625
-#            grindEmpty = scene.objects['grindEmpty']
626
-#            grindDar = grindEmpty.sensors['grindDar2']
627
-#            minDist = None             
628
-#            if grindDar.positive:
629
-#                detectedObjects = grindDar.hitObjectList
630
-#                dist = 0
631
-#                for obj in detectedObjects:
632
-#                    dist = own.getDistanceTo(obj)
633
-#                    if (minDist is None or dist < minDist):
634
-#                        nearestObject = obj
635
-#                        minDist = dist
636
-#            if nearestObject != None:
637
-#                print(nearestObject)
638
-#                obj = nearestObject
639
-#                player_e = own.worldOrientation.to_euler()
640
-#                player_pos = own.worldPosition
641
-#                player_rotz = math.degrees(player_e[2])                
642
-#                grinder_e = obj.worldOrientation.to_euler()
643
-#                grinder_rotz = math.degrees(grinder_e[2])            
644
-#                rot = player_rotz - grinder_rotz  
645
-#                
646
-#                
647
-#                grinder_pos = obj.worldPosition 
648
-#                worldVect = [1, 0, 0]
649
-#                vect = obj.getAxisVect(worldVect)      
650
-#                go = obj.worldOrientation
651
-#                grinder_axis = [1,0,0] 
652
-#                try: 
653
-#                    delta = player_pos - grinder_pos
654
-#                    
655
-#                    delta = delta.cross(vect)
656
-#                    if delta[2] >= 0:
657
-#                        grindside = "right"
658
-#                    else:
659
-#                        grindside = "left"                    
660
-#                    deltamove = delta[2] * .1#.25
661
-#                    move = [0, deltamove, 0]
662
-#                    print("1deltamove", deltamove)
663
-#                    own.applyMovement(move, True)                    
664
-#                except:
665
-#                    print("delta broke: ", player_pos, grinder_pos)
666
-#                    #pass 
667
-         
624
+            nearestObject = None
625
+            grindEmpty = scene.objects['grindEmpty']
626
+            grindDar = grindEmpty.sensors['grindDar2']
627
+            minDist = None             
628
+            if grindDar.positive:
629
+                detectedObjects = grindDar.hitObjectList
630
+                dist = 0
631
+                for obj in detectedObjects:
632
+                    dist = own.getDistanceTo(obj)
633
+                    if (minDist is None or dist < minDist):
634
+                        nearestObject = obj
635
+                        minDist = dist
636
+            if nearestObject != None:
637
+                print(nearestObject)
638
+                obj = nearestObject
639
+                player_e = own.worldOrientation.to_euler()
640
+                player_pos = own.worldPosition
641
+                player_rotz = math.degrees(player_e[2])                
642
+                grinder_e = obj.worldOrientation.to_euler()
643
+                grinder_rotz = math.degrees(grinder_e[2])            
644
+                rot = player_rotz - grinder_rotz  
645
+                
646
+                
647
+                grinder_pos = obj.worldPosition 
648
+                worldVect = [1, 0, 0]
649
+                vect = obj.getAxisVect(worldVect)      
650
+                go = obj.worldOrientation
651
+                grinder_axis = [1,0,0] 
652
+                try: 
653
+                    delta = player_pos - grinder_pos
654
+                    
655
+                    delta = delta.cross(vect)
656
+                    if delta[2] >= 0:
657
+                        grindside = "right"
658
+                    else:
659
+                        grindside = "left"                    
660
+                    deltamove = delta[2] * .1#.25
661
+                    move = [-deltamove, 0, 0]
662
+                    #print("1deltamove", deltamove)
663
+                    own.applyMovement(move, True)                    
664
+                except:
665
+                    #print("delta broke: ", player_pos, grinder_pos)
666
+                    pass 
667
+
668 668
             if STANCE == 0: 
669 669
                 own['requestAction'] ='reg_dropin_pos' 
670 670
                 own['dropinTimer'] = 60                                     

Loading…
Cancel
Save