|
@@ -1,17 +1,22 @@
|
|
1
|
+"""controls grind physics and sends results to controller2.py for setting the grind animations."""
|
|
2
|
+
|
1
|
3
|
import bge
|
2
|
4
|
import math
|
3
|
5
|
|
4
|
6
|
def main():
|
|
7
|
+
|
|
8
|
+
|
5
|
9
|
cont = bge.logic.getCurrentController()
|
6
|
10
|
own = cont.owner
|
7
|
11
|
player = cont.owner
|
8
|
12
|
scene = bge.logic.getCurrentScene()
|
|
13
|
+ dict = bge.logic.globalDict
|
9
|
14
|
#grindDar = cont.sensors['grindDar']
|
10
|
15
|
grindEmpty = scene.objects['grindEmpty']
|
11
|
|
- grindDar = grindEmpty.sensors['grindDar2']
|
|
16
|
+ grindDar = grindEmpty.sensors['grindDar2']
|
12
|
17
|
rGround = cont.sensors['r_Ground']
|
13
|
18
|
control_bottom = scene.objects['control_bottom']
|
14
|
|
- #grindCol_bottom
|
|
19
|
+ #grindCol_bottom
|
15
|
20
|
grindTouch = control_bottom.sensors['grindCol_bottom']
|
16
|
21
|
#grindTouch = cont.sensors['grindCol']
|
17
|
22
|
invertCol = cont.sensors['invertCol']
|
|
@@ -25,23 +30,23 @@ def main():
|
25
|
30
|
test = own["test"]
|
26
|
31
|
grindold = own["grindOld"]
|
27
|
32
|
lgobj = own["lGobj"]
|
28
|
|
- countdown = own['grindCountdown']
|
|
33
|
+ countdown = own['grindCountdown']
|
29
|
34
|
#print(lgobj)
|
30
|
35
|
ray = cont.sensors["GuardDuty"] # get the ray sensor attached to the controller named GuardDuty
|
31
|
36
|
gt_cd = own["gt_cd"]
|
32
|
37
|
pos = ray.hitPosition # get position where the game object hit by ray
|
33
|
38
|
linVelocity = own.getLinearVelocity(False)
|
34
|
39
|
linVelocity2 = own.getLinearVelocity(True)
|
35
|
|
- pos[2] = pos[2] + 1
|
|
40
|
+ pos[2] = pos[2] + 1
|
36
|
41
|
norm = ray.hitNormal
|
37
|
42
|
STANCE = own["stance"]
|
38
|
43
|
orientation = own.worldOrientation
|
39
|
44
|
test = ray.hitObject
|
40
|
45
|
xyz = own.worldOrientation.to_euler()
|
41
|
46
|
rotz = math.degrees(xyz[2])
|
42
|
|
- roty = math.degrees(xyz[1])
|
|
47
|
+ roty = math.degrees(xyz[1])
|
43
|
48
|
#print(roty)
|
44
|
|
- roty = abs(roty)
|
|
49
|
+ roty = abs(roty)
|
45
|
50
|
sub = 0
|
46
|
51
|
align_strength = .1#.3
|
47
|
52
|
align_strength2 = .2
|
|
@@ -61,7 +66,7 @@ def main():
|
61
|
66
|
last_grindDar = 0
|
62
|
67
|
last_manual = own["manual"]
|
63
|
68
|
joinit = 0
|
64
|
|
- rot = own.getAxisVect( [0.0, 0.0, 1.0])
|
|
69
|
+ rot = own.getAxisVect([0.0, 0.0, 1.0])
|
65
|
70
|
dropin = own['dropinTimer']
|
66
|
71
|
nearestObject = None
|
67
|
72
|
last_hit = own['grindDar_hit']
|
|
@@ -72,14 +77,13 @@ def main():
|
72
|
77
|
grindvect = None
|
73
|
78
|
grindyvect = None
|
74
|
79
|
skipcol = 0
|
75
|
|
- skipconst = 0
|
76
|
80
|
try:
|
77
|
81
|
no_grind_pull = own['no_grind_pull']
|
78
|
|
- except:
|
|
82
|
+ except:
|
79
|
83
|
own['no_grind_pull'] = 0
|
80
|
84
|
no_grind_pull = 0
|
81
|
|
-
|
82
|
|
- since_jumped = framenum - own['last_jump_frame']
|
|
85
|
+
|
|
86
|
+ since_jumped = framenum - own['last_jump_frame']
|
83
|
87
|
#no grind
|
84
|
88
|
no_grind = 1
|
85
|
89
|
if jump_timer > 50:
|
|
@@ -87,35 +91,45 @@ def main():
|
87
|
91
|
if own['no_grind_timer'] > 0:
|
88
|
92
|
no_grind = 0
|
89
|
93
|
own['no_grind_timer'] -= 1
|
90
|
|
-
|
|
94
|
+
|
91
|
95
|
if grindold == 1:
|
92
|
|
- no_grind = 0
|
|
96
|
+ no_grind = 0
|
93
|
97
|
#don't grind unless you were in the air recently or were on a ramp recently or were grinding.
|
94
|
|
-
|
|
98
|
+
|
95
|
99
|
#if (own['onramp'] == 0 and frames_since_grind > 30):
|
96
|
100
|
#no_grind = 1
|
97
|
|
-
|
|
101
|
+
|
98
|
102
|
#if frames_since_grind > 30:
|
99
|
103
|
#no_grind = 0
|
100
|
|
-
|
|
104
|
+
|
101
|
105
|
if frames_since_ground > 30 or since_jumped < 120:
|
102
|
|
- no_grind = 0
|
|
106
|
+ no_grind = 0
|
103
|
107
|
if jump_timer > 50:
|
104
|
108
|
no_grind = 1
|
105
|
|
-
|
106
|
|
-
|
|
109
|
+ if grindold == 0 and (dict['lUD'] < -.04 or dict['lUD'] > .04):
|
|
110
|
+ no_grind = 1
|
|
111
|
+
|
107
|
112
|
#print('no grind timer', no_grind, own['no_grind_timer'])
|
108
|
|
-
|
109
|
|
-
|
|
113
|
+
|
|
114
|
+
|
110
|
115
|
if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1):
|
111
|
|
- manual = 1
|
|
116
|
+ manual = 1
|
112
|
117
|
else:
|
113
|
118
|
manual = 0
|
114
|
119
|
#manual = own['manual']
|
115
|
120
|
own["nogrindsound"] = 0
|
116
|
|
-
|
117
|
|
-#---------###########___###########-----------
|
118
|
|
-#start new #######
|
|
121
|
+ 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):
|
|
125
|
+ no_grind = 0
|
|
126
|
+ #print('no_grind = 0')
|
|
127
|
+ if own['LAST_GRIND']:
|
|
128
|
+ no_grind = 0
|
|
129
|
+ # if (dict['lUD'] < -.04 or dict['lUD'] > .04):
|
|
130
|
+ # no_grind = 0
|
|
131
|
+#---------###########___###########-----------
|
|
132
|
+#start new #######
|
119
|
133
|
##----------##############----------############
|
120
|
134
|
|
121
|
135
|
#grindvect func
|
|
@@ -124,79 +138,82 @@ def main():
|
124
|
138
|
lastobj = own["grindTouchobj"]
|
125
|
139
|
grindpos = own["grindpos"]
|
126
|
140
|
player_e = own.worldOrientation.to_euler()
|
127
|
|
- player_rotz = math.degrees(player_e[2])
|
|
141
|
+ player_rotz = math.degrees(player_e[2])
|
128
|
142
|
velxb = linVelocity2.x
|
129
|
143
|
player_e = own.worldOrientation.to_euler()
|
130
|
|
-
|
|
144
|
+
|
131
|
145
|
ogrot = own.orientation
|
132
|
146
|
ogrot = player_e
|
133
|
|
-
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+ #print(touched, 'touched')
|
|
150
|
+
|
134
|
151
|
if (framenum - gsf) > 15:
|
135
|
152
|
velx = linVelocity2.x
|
136
|
153
|
vely = linVelocity2.y
|
137
|
154
|
#print("limit speed")
|
138
|
|
- else:
|
139
|
|
- velx = linVelocity2.x
|
140
|
|
- vely = linVelocity2.y
|
|
155
|
+ else:
|
|
156
|
+ velx = linVelocity2.x
|
|
157
|
+ vely = linVelocity2.y
|
141
|
158
|
if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
|
142
|
159
|
#convely = own['pregrind_vely']
|
143
|
160
|
#print('changing convely')
|
144
|
161
|
convely = vely
|
145
|
162
|
else:
|
146
|
|
- convely = vely
|
|
163
|
+ convely = vely
|
147
|
164
|
def grindvect(obj):
|
148
|
165
|
STANCE = own['stance']
|
149
|
166
|
if obj != None:
|
150
|
167
|
grinder_e = obj.worldOrientation.to_euler()
|
151
|
|
- grinder_rotz = math.degrees(grinder_e[2])
|
|
168
|
+ grinder_rotz = math.degrees(grinder_e[2])
|
152
|
169
|
rot = player_rotz - grinder_rotz
|
153
|
|
- if rot >= 0 and rot < 45:
|
|
170
|
+ if rot >= 0 and rot < 45:
|
|
171
|
+ grindvect = "pos"
|
|
172
|
+ if rot >= 45 and rot < 90:
|
154
|
173
|
grindvect = "pos"
|
155
|
|
- if rot >= 45 and rot < 90:
|
156
|
|
- grindvect = "pos"
|
157
|
174
|
grindyvect = "pos"
|
158
|
|
- if rot >= 90 and rot < 135:
|
|
175
|
+ if rot >= 90 and rot < 135:
|
159
|
176
|
grindvect = "neg"
|
160
|
177
|
grindyvect = "neg"
|
161
|
|
- if rot >= 135 and rot < 180:
|
|
178
|
+ if rot >= 135 and rot < 180:
|
162
|
179
|
grindvect = "neg"
|
163
|
|
- if rot >= 180 and rot < 225:
|
|
180
|
+ if rot >= 180 and rot < 225:
|
164
|
181
|
grindvect = "neg"
|
165
|
|
- if rot >= 225 and rot < 270:
|
|
182
|
+ if rot >= 225 and rot < 270:
|
166
|
183
|
grindvect = "neg"
|
167
|
184
|
grindyvect = "pos"
|
168
|
|
- if rot >= 270 and rot < 315:
|
169
|
|
- grindvect = "pos"
|
|
185
|
+ if rot >= 270 and rot < 315:
|
|
186
|
+ grindvect = "pos"
|
170
|
187
|
grindyvect = "neg"
|
171
|
|
- if rot >= 315:
|
|
188
|
+ if rot >= 315:
|
172
|
189
|
grindvect = "pos"
|
173
|
|
- if rot < 0 and rot >= -45:
|
|
190
|
+ if rot < 0 and rot >= -45:
|
174
|
191
|
grindvect = "pos"
|
175
|
|
- if rot < -45 and rot >= -90:
|
|
192
|
+ if rot < -45 and rot >= -90:
|
176
|
193
|
grindvect = "pos"
|
177
|
194
|
grindyvect = "neg"
|
178
|
|
- if rot < -90 and rot >= -135:
|
|
195
|
+ if rot < -90 and rot >= -135:
|
179
|
196
|
grindvect = "neg"
|
180
|
197
|
grindyvect = "pos"
|
181
|
|
- if rot < -135 and rot >= -180:
|
182
|
|
- grindvect = "neg"
|
183
|
|
- if rot < -180 and rot >= -225:
|
184
|
|
- grindvect = "neg"
|
185
|
|
- if rot < -225 and rot >= -270:
|
|
198
|
+ if rot < -135 and rot >= -180:
|
|
199
|
+ grindvect = "neg"
|
|
200
|
+ if rot < -180 and rot >= -225:
|
|
201
|
+ grindvect = "neg"
|
|
202
|
+ if rot < -225 and rot >= -270:
|
186
|
203
|
grindvect = "neg"
|
187
|
204
|
grindyvect = "neg"
|
188
|
|
- if rot < -270 and rot >= -315:
|
189
|
|
- grindvect = "pos"
|
|
205
|
+ if rot < -270 and rot >= -315:
|
|
206
|
+ grindvect = "pos"
|
190
|
207
|
grindyvect = "pos"
|
191
|
|
- if rot < -315:
|
192
|
|
- grindvect = "pos"
|
|
208
|
+ if rot < -315:
|
|
209
|
+ grindvect = "pos"
|
193
|
210
|
|
194
|
211
|
rot = round((rot * .01), 1)
|
195
|
212
|
rot *= 100
|
196
|
213
|
|
197
|
214
|
#print(own['inverting'])
|
198
|
|
- if frames_grinding > 20 and own['inverting'] == False:
|
199
|
|
- #print("setting stance")
|
|
215
|
+ if frames_grinding > 20 and own['inverting'] == False:
|
|
216
|
+ #print("setting stance")
|
200
|
217
|
if (rot == 90 or rot == -270) and STANCE == True:
|
201
|
218
|
#print("90 fak stance")
|
202
|
219
|
own['stance'] = 1
|
|
@@ -210,88 +227,87 @@ def main():
|
210
|
227
|
own['stance'] = 0
|
211
|
228
|
STANCE = 0
|
212
|
229
|
if (rot == -90 or rot == 270) and STANCE == False:
|
213
|
|
- #print("-90 reg stance")
|
|
230
|
+ #print("-90 reg stance")
|
214
|
231
|
own['stance'] = 0
|
215
|
232
|
STANCE = 0
|
216
|
|
- def grindrotvel(obj):
|
217
|
|
- skipconst = 1
|
|
233
|
+ def grindrotvel(obj):
|
218
|
234
|
joinit = 0
|
219
|
235
|
grinder_e = obj.worldOrientation.to_euler()
|
220
|
|
- grinder_rotz = math.degrees(grinder_e[2])
|
221
|
|
- grinder_vect = obj.getAxisVect( [1, 0, 0])
|
222
|
|
- grinder_vectz = obj.getAxisVect( [0, 0, 1])
|
223
|
|
- rot = player_rotz - grinder_rotz
|
|
236
|
+ grinder_rotz = math.degrees(grinder_e[2])
|
|
237
|
+ grinder_vect = obj.getAxisVect([1, 0, 0])
|
|
238
|
+ grinder_vectz = obj.getAxisVect([0, 0, 1])
|
|
239
|
+ rot = player_rotz - grinder_rotz
|
224
|
240
|
rayhit = ray.hitObject
|
225
|
241
|
own['grind_rot'] = rot
|
226
|
|
- vect = obj.getAxisVect( [1.0, 0.0, 0.0])
|
|
242
|
+ vect = obj.getAxisVect([1.0, 0.0, 0.0])
|
227
|
243
|
xyzb = obj.worldOrientation.to_euler()
|
228
|
|
- rotzb = math.degrees(xyzb[2])
|
229
|
|
- grindpos = "None"
|
|
244
|
+ rotzb = math.degrees(xyzb[2])
|
|
245
|
+ grindpos = "None"
|
230
|
246
|
align = "None"
|
231
|
247
|
sub_converted = 0
|
232
|
248
|
rotz = math.degrees(xyz[2])
|
233
|
249
|
roty = math.degrees(xyz[1])
|
234
|
|
- bsrot = [ 0.0, 0.0, 1.570796327]
|
235
|
|
- negbsrot = [ 0.0, 0.0, -1.570796327]
|
|
250
|
+ bsrot = [0.0, 0.0, 1.570796327]
|
|
251
|
+ negbsrot = [0.0, 0.0, -1.570796327]
|
236
|
252
|
zvel = own.linearVelocity
|
237
|
253
|
zvel = zvel.z * .95
|
238
|
254
|
if grindold == 0:
|
239
|
255
|
if rotz < 0:
|
240
|
256
|
rotz = rotz + 360
|
241
|
257
|
if rotzb < 0:
|
242
|
|
- rotzb = rotzb + 360
|
|
258
|
+ rotzb = rotzb + 360
|
243
|
259
|
if rotz > rotzb:
|
244
|
260
|
sub_converted = rotz - rotzb
|
245
|
261
|
if rotz < rotzb:
|
246
|
262
|
sub_converted = rotzb - rotz
|
247
|
263
|
|
248
|
264
|
#z align
|
249
|
|
- #print("zalign")
|
|
265
|
+ #print("zalign")
|
250
|
266
|
stre = .15#.075#.15
|
251
|
|
- player.alignAxisToVect(grinder_vectz, 2, stre)
|
252
|
|
-
|
|
267
|
+ player.alignAxisToVect(grinder_vectz, 2, stre)
|
|
268
|
+
|
253
|
269
|
if rot >= 0 and rot < 45:
|
254
|
270
|
player.alignAxisToVect(grinder_vect, 0, align_strength)
|
255
|
271
|
grindvect = "pos"
|
256
|
|
- #player.applyForce([0, 0, 0], True)
|
257
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
272
|
+ #player.applyForce([0, 0, 0], True)
|
|
273
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
258
|
274
|
grindpos = "reg_5050"
|
259
|
275
|
#print("50-1")
|
260
|
276
|
|
261
|
277
|
|
262
|
|
- elif rot >= 45 and rot < 90:
|
|
278
|
+ elif rot >= 45 and rot < 90:
|
263
|
279
|
player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
|
264
|
280
|
grindvect = "pos"
|
265
|
|
- align = "pos"
|
266
|
|
- player.setLinearVelocity([0, convely, zvel], 1)
|
267
|
|
- grindpos = "reg_board"
|
|
281
|
+ align = "pos"
|
|
282
|
+ player.setLinearVelocity([0, convely, zvel], 1)
|
|
283
|
+ grindpos = "reg_board"
|
268
|
284
|
grindyvect = "pos"
|
269
|
|
- #print("bs1, don't switch")
|
270
|
|
-
|
271
|
|
- elif rot >= 90 and rot < 135:
|
272
|
|
- grinder_vect = grinder_vect * -1
|
273
|
|
- player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
|
285
|
+ #print("bs1, don't switch")
|
|
286
|
+
|
|
287
|
+ elif rot >= 90 and rot < 135:
|
|
288
|
+ grinder_vect = grinder_vect * -1
|
|
289
|
+ player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
274
|
290
|
grindvect = "neg"
|
275
|
291
|
align = "neg"
|
276
|
292
|
grindyvect = "neg"
|
277
|
293
|
player.setLinearVelocity([0, convely, zvel], 1)
|
278
|
|
- grindpos = "reg_board"
|
279
|
|
- #print("-bs2, don't switch?")
|
280
|
|
-
|
|
294
|
+ grindpos = "reg_board"
|
|
295
|
+ #print("-bs2, don't switch?")
|
|
296
|
+
|
281
|
297
|
elif rot >= 135 and rot < 180:
|
282
|
298
|
player.alignAxisToVect(-grinder_vect, 0, align_strength)
|
283
|
299
|
grindvect = "neg"
|
284
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
300
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
285
|
301
|
grindpos = "reg_5050"
|
286
|
302
|
#print("50-2")
|
287
|
|
-
|
|
303
|
+
|
288
|
304
|
elif rot >= 180 and rot < 225:
|
289
|
305
|
player.alignAxisToVect(-grinder_vect, 0, align_strength)
|
290
|
306
|
grindvect = "neg"
|
291
|
307
|
player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
292
|
|
- grindpos = "reg_5050"
|
|
308
|
+ grindpos = "reg_5050"
|
293
|
309
|
#print("50-3")
|
294
|
|
-
|
|
310
|
+
|
295
|
311
|
elif rot >= 225 and rot < 270:
|
296
|
312
|
player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
297
|
313
|
grindvect = "neg"
|
|
@@ -299,130 +315,129 @@ def main():
|
299
|
315
|
player.setLinearVelocity([0, convely, zvel], 1)
|
300
|
316
|
grindpos = "reg_board"
|
301
|
317
|
grindyvect = "pos"
|
302
|
|
- #print("bs3")
|
303
|
|
-
|
|
318
|
+ #print("bs3")
|
|
319
|
+
|
304
|
320
|
elif rot >= 270 and rot < 315:
|
305
|
|
- player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
306
|
|
- grindvect = "pos"
|
|
321
|
+ player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
|
322
|
+ grindvect = "pos"
|
307
|
323
|
align = "neg"
|
308
|
324
|
player.setLinearVelocity([0, convely, zvel], 1)
|
309
|
|
- grindpos = "reg_board"
|
|
325
|
+ grindpos = "reg_board"
|
310
|
326
|
grindyvect = "neg"
|
311
|
|
- #print("-bs4")
|
312
|
|
-
|
|
327
|
+ #print("-bs4")
|
|
328
|
+
|
313
|
329
|
elif rot >= 315:
|
314
|
330
|
player.alignAxisToVect(grinder_vect, 0, align_strength)
|
315
|
331
|
grindvect = "pos"
|
316
|
332
|
player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
317
|
333
|
grindpos = "reg_5050"
|
318
|
334
|
#print("50-4")
|
319
|
|
-
|
320
|
|
-#-------------------------------------------------------------
|
|
335
|
+
|
|
336
|
+#-------------------------------------------------------------
|
321
|
337
|
elif rot < 0 and rot >= -45:
|
322
|
338
|
player.alignAxisToVect(grinder_vect, 0, align_strength)
|
323
|
339
|
grindvect = "pos"
|
324
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
325
|
|
- grindpos = "reg_5050"
|
326
|
|
- #print("50-5")
|
|
340
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
341
|
+ grindpos = "reg_5050"
|
|
342
|
+ #print("50-5")
|
327
|
343
|
elif rot < -45 and rot >= -90:
|
328
|
344
|
grinder_vect = grinder_vect * -1
|
329
|
345
|
player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
|
330
|
346
|
grindvect = "pos"
|
331
|
347
|
align = "neg"
|
332
|
348
|
player.setLinearVelocity([0, convely, zvel], 1)
|
333
|
|
- grindpos = "reg_board"
|
334
|
|
- #print("-bs5")
|
|
349
|
+ grindpos = "reg_board"
|
|
350
|
+ #print("-bs5")
|
335
|
351
|
grindyvect = "neg"
|
336
|
352
|
elif rot < -90 and rot >= -135:
|
337
|
353
|
player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
338
|
354
|
grindvect = "neg"
|
339
|
355
|
align = "pos"
|
340
|
356
|
player.setLinearVelocity([0, convely, zvel], 1)
|
341
|
|
- grindpos = "reg_board"
|
|
357
|
+ grindpos = "reg_board"
|
342
|
358
|
grindyvect = "pos"
|
343
|
|
- #print("bs6")
|
|
359
|
+ #print("bs6")
|
344
|
360
|
elif rot < -135 and rot >= -180:
|
345
|
361
|
player.alignAxisToVect(-grinder_vect, 0, align_strength)
|
346
|
|
- grindvect = "neg"
|
347
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
348
|
|
- grindpos = "reg_5050"
|
349
|
|
- #print("50-6")
|
|
362
|
+ grindvect = "neg"
|
|
363
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
364
|
+ grindpos = "reg_5050"
|
|
365
|
+ #print("50-6")
|
350
|
366
|
elif rot < -180 and rot >= -225:
|
351
|
|
- player.alignAxisToVect(-grinder_vect, 0, align_strength)
|
352
|
|
- grindvect = "neg"
|
353
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
354
|
|
- grindpos = "reg_5050"
|
|
367
|
+ player.alignAxisToVect(-grinder_vect, 0, align_strength)
|
|
368
|
+ grindvect = "neg"
|
|
369
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
370
|
+ grindpos = "reg_5050"
|
355
|
371
|
#print("50-7")
|
356
|
372
|
elif rot < -225 and rot >= -270:
|
357
|
373
|
grinder_vect = grinder_vect * -1
|
358
|
|
- player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
|
374
|
+ player.alignAxisToVect([grinder_vect.y, -grinder_vect.x, 0], 0, align_strength)
|
359
|
375
|
grindvect = "neg"
|
360
|
376
|
align = "neg"
|
361
|
377
|
player.setLinearVelocity([0, convely, zvel], 1)
|
362
|
|
- grindpos = "reg_board"
|
|
378
|
+ grindpos = "reg_board"
|
363
|
379
|
grindyvect = "neg"
|
364
|
|
- #print("-bs7")
|
|
380
|
+ #print("-bs7")
|
365
|
381
|
elif rot < -270 and rot >= -315:
|
366
|
|
- player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
|
|
382
|
+ player.alignAxisToVect([-grinder_vect.y, grinder_vect.x, 0], 0, align_strength)
|
367
|
383
|
grindvect = "pos"
|
368
|
384
|
align = "pos"
|
369
|
385
|
player.setLinearVelocity([0, convely, zvel], 1)
|
370
|
|
- grindpos = "reg_board"
|
|
386
|
+ grindpos = "reg_board"
|
371
|
387
|
grindyvect = "pos"
|
372
|
|
- #print("bs8")
|
|
388
|
+ #print("bs8")
|
373
|
389
|
elif rot < -315:
|
374
|
|
- player.alignAxisToVect(grinder_vect, 0, align_strength)
|
375
|
|
- grindvect = "pos"
|
376
|
|
- player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
377
|
|
- grindpos = "reg_5050"
|
|
390
|
+ player.alignAxisToVect(grinder_vect, 0, align_strength)
|
|
391
|
+ grindvect = "pos"
|
|
392
|
+ player.setLinearVelocity([velxb, 0.0, zvel], 1)
|
|
393
|
+ grindpos = "reg_5050"
|
378
|
394
|
#print("50-8")
|
379
|
395
|
|
380
|
396
|
own['grindpos'] = grindpos
|
381
|
397
|
own['grindvect'] = grindvect
|
382
|
398
|
own['grindervect'] = grinder_vect
|
383
|
|
- try:
|
|
399
|
+ try:
|
384
|
400
|
own['grindyvect'] = grindyvect
|
385
|
|
-
|
|
401
|
+
|
386
|
402
|
except:
|
387
|
|
- pass
|
388
|
|
-
|
389
|
|
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
403
|
+ pass
|
|
404
|
+
|
|
405
|
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
390
|
406
|
def grind(obj):
|
391
|
407
|
try:
|
392
|
408
|
grindyvect = own['grindyvect']
|
393
|
409
|
except:
|
394
|
|
- grindyvect = 0
|
395
|
|
- grindvect = own['grindvect']
|
396
|
|
-
|
|
410
|
+ grindyvect = 0
|
|
411
|
+ grindvect = own['grindvect']
|
|
412
|
+
|
397
|
413
|
if 'rail' in obj:
|
398
|
|
- own["grindSound"] = "rail"
|
|
414
|
+ own["grindSound"] = "rail"
|
399
|
415
|
else:
|
400
|
416
|
own["grindSound"] = "concrete"
|
401
|
|
- own['lGobj'] = obj
|
402
|
|
-
|
403
|
|
- grinding = 1
|
404
|
|
-
|
|
417
|
+ own['lGobj'] = obj
|
|
418
|
+
|
|
419
|
+ grinding = 1
|
|
420
|
+
|
405
|
421
|
framenum = own['framenum']
|
406
|
422
|
lastairframe = own['lF_air_frame']
|
407
|
423
|
jumpside = 0
|
408
|
424
|
if (framenum - lastairframe) < 10:
|
409
|
|
- player_pos = own['jumpPos']
|
410
|
|
- jumpside = 1
|
411
|
|
- else:
|
|
425
|
+ player_pos = own['jumpPos']
|
|
426
|
+ jumpside = 1
|
|
427
|
+ else:
|
412
|
428
|
player_pos = OG_PLAYER_POS
|
413
|
|
- player_pos = own.worldPosition
|
414
|
|
- try:
|
415
|
|
- if 1 == 1:
|
416
|
|
- grinder_pos = obj.worldPosition
|
|
429
|
+ player_pos = own.worldPosition
|
|
430
|
+ try:
|
|
431
|
+ if 1 == 1:
|
|
432
|
+ grinder_pos = obj.worldPosition
|
417
|
433
|
worldVect = [1, 0, 0]
|
418
|
|
- vect = obj.getAxisVect(worldVect)
|
419
|
|
- go = obj.worldOrientation
|
420
|
|
- grinder_axis = [0,1,0]
|
421
|
|
- try:
|
|
434
|
+ vect = obj.getAxisVect(worldVect)
|
|
435
|
+ grinder_axis = [0, 1, 0]
|
|
436
|
+ try:
|
422
|
437
|
delta = player_pos - grinder_pos
|
423
|
438
|
except:
|
424
|
439
|
#print("delta broke: ", player_pos, grinder_pos)
|
425
|
|
- pass
|
|
440
|
+ pass
|
426
|
441
|
delta = delta.cross(vect)
|
427
|
442
|
if delta[2] >= 0:
|
428
|
443
|
grindside = "right"
|
|
@@ -431,7 +446,7 @@ def main():
|
431
|
446
|
grindside = "left"
|
432
|
447
|
edge = 0
|
433
|
448
|
if 'edge' in obj:
|
434
|
|
- edge = 1
|
|
449
|
+ edge = 1
|
435
|
450
|
#print('grind on', grindside, edge)
|
436
|
451
|
if (delta[2] > .00001 or delta[2] < -.00001) and (delta[2] < .8 or delta[2] < -.8):
|
437
|
452
|
rotation = own.worldOrientation[2] - obj.worldOrientation[2]
|
|
@@ -447,57 +462,58 @@ def main():
|
447
|
462
|
if (jumpside == 1 or jumpside == 0) and grindvect == "pos":
|
448
|
463
|
move = [0, deltamove, 0]
|
449
|
464
|
#print("1deltamove", deltamove)
|
450
|
|
- own.applyMovement(move, True)
|
|
465
|
+ own.applyMovement(move, True)
|
451
|
466
|
if (jumpside == 1 or jumpside == 0) and grindvect == "neg":
|
452
|
467
|
move = [0, -deltamove, 0]
|
453
|
468
|
#print("2deltamove -", deltamove)
|
454
|
|
- own.applyMovement(move, True)
|
|
469
|
+ own.applyMovement(move, True)
|
455
|
470
|
#board
|
456
|
471
|
if own["grindpos"] == "reg_board":
|
457
|
472
|
if grindvect == "neg":
|
458
|
473
|
if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
|
459
|
474
|
move = [-deltamove, 0, 0]
|
460
|
475
|
#print("3deltamove", deltamove)
|
461
|
|
- own.applyMovement(move, True)
|
|
476
|
+ own.applyMovement(move, True)
|
462
|
477
|
if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
|
463
|
478
|
move = [deltamove, 0, 0]
|
464
|
479
|
#print("4deltamove -", deltamove)
|
465
|
|
- own.applyMovement(move, True)
|
|
480
|
+ own.applyMovement(move, True)
|
466
|
481
|
if grindvect == "pos":
|
467
|
482
|
if (jumpside == 1 or jumpside == 0) and grindyvect == "pos":
|
468
|
483
|
move = [deltamove, 0, 0]
|
469
|
484
|
#print("5deltamove", deltamove)
|
470
|
|
- own.applyMovement(move, True)
|
|
485
|
+ own.applyMovement(move, True)
|
471
|
486
|
if (jumpside == 1 or jumpside == 0) and grindyvect == "neg":
|
472
|
487
|
move = [-deltamove, 0, 0]
|
473
|
|
- own.applyMovement(move, True)
|
474
|
|
- own['grindside'] = grindside
|
|
488
|
+ own.applyMovement(move, True)
|
|
489
|
+ own['grindside'] = grindside
|
475
|
490
|
except:
|
476
|
|
- pass
|
477
|
|
- #speed limit
|
|
491
|
+ print('something in grinding is wrong')
|
|
492
|
+ #pass
|
|
493
|
+ #speed limit
|
478
|
494
|
velo = own.getLinearVelocity(True)
|
479
|
495
|
touchobj = obj
|
480
|
|
- if touchobj != None and gt_cd == 0:
|
|
496
|
+ if touchobj != None and gt_cd == 0:
|
481
|
497
|
if 'rail' in touchobj:
|
482
|
|
- newvelx = velo.x * grindspeed_rail
|
|
498
|
+ newvelx = velo.x * grindspeed_rail
|
483
|
499
|
newvely = velo.y * grindspeed_rail
|
484
|
500
|
else:
|
485
|
|
- newvelx = velo.x * grindspeed_cement
|
486
|
|
- newvely = velo.y * grindspeed_cement
|
487
|
|
- player.setLinearVelocity([newvelx, newvely, velo.z], 1)
|
|
501
|
+ newvelx = velo.x * grindspeed_cement
|
|
502
|
+ newvely = velo.y * grindspeed_cement
|
|
503
|
+ player.setLinearVelocity([newvelx, newvely, velo.z], 1)
|
488
|
504
|
player_rot = own.worldOrientation[2]
|
489
|
505
|
grinder_rot = touchobj.worldOrientation[2]
|
490
|
|
- player_rot = own.getAxisVect( [0.0, 0.0, 1.0])
|
|
506
|
+ player_rot = own.getAxisVect([0.0, 0.0, 1.0])
|
491
|
507
|
xyz3 = own.worldOrientation.to_euler()
|
492
|
508
|
player_rot = math.degrees(xyz3[2])
|
493
|
509
|
xyz4 = touchobj.worldOrientation.to_euler()
|
494
|
|
- grinder_rot = math.degrees(xyz4[2])
|
|
510
|
+ grinder_rot = math.degrees(xyz4[2])
|
495
|
511
|
if player_rot < 0:
|
496
|
512
|
player_rot = abs(player_rot) + 180
|
497
|
513
|
if grinder_rot < 0:
|
498
|
|
- grinder_rot = abs(grinder_rot) + 180
|
|
514
|
+ grinder_rot = abs(grinder_rot) + 180
|
499
|
515
|
subtraction = player_rot - grinder_rot
|
500
|
|
-
|
|
516
|
+
|
501
|
517
|
def invertpos(detectedObjects):
|
502
|
518
|
minDist = None
|
503
|
519
|
nearestObject = None
|
|
@@ -506,32 +522,32 @@ def main():
|
506
|
522
|
if (minDist is None or dist < minDist):
|
507
|
523
|
nearestObject = obj
|
508
|
524
|
minDist = dist
|
509
|
|
- if nearestObject != None:
|
|
525
|
+ if nearestObject != None:
|
510
|
526
|
own.linearVelocity.x = 0
|
511
|
|
- own.linearVelocity.y = 0
|
512
|
|
-
|
|
527
|
+ own.linearVelocity.y = 0
|
|
528
|
+
|
513
|
529
|
if grindDar.positive == False and grindTouch.triggered and grindold == 0 and dropin == 0 and grind_jump == 0 and own["grindoutturn"] == 0 and gt_cd == 0 and manual == 0 and no_grind == 0 and nearestObject != lastObject and own['grindjumpturn'] == 0 and own['gt_cd2'] == 0 and own['air_mover'] == False:
|
514
|
530
|
#print("touching, no dar")
|
515
|
531
|
pass
|
516
|
|
- #print(grindold, "grindold")
|
517
|
|
- skipper = 0
|
518
|
|
- if (grindDar.positive or grindTouch.positive) and no_grind == 0:
|
|
532
|
+ #print(grindold, "grindold")
|
|
533
|
+ skipper = 0
|
|
534
|
+ if (grindDar.positive or grindTouch.positive) and no_grind == 0:
|
519
|
535
|
if grindDar.positive:
|
520
|
536
|
detectedObjects = grindDar.hitObjectList
|
521
|
|
- dist = 0
|
|
537
|
+ dist = 0.0
|
522
|
538
|
for obj in detectedObjects:
|
523
|
539
|
dist = own.getDistanceTo(obj)
|
524
|
540
|
if (minDist is None or dist < minDist):
|
525
|
541
|
nearestObject = obj
|
526
|
|
- minDist = dist
|
|
542
|
+ minDist = dist
|
527
|
543
|
elif grindTouch.positive:
|
528
|
544
|
nearestObject = grindTouch.hitObject
|
529
|
545
|
dist = .7
|
530
|
|
- #print('using touch object')
|
531
|
|
-
|
532
|
|
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
546
|
+ #print('using touch object')
|
|
547
|
+
|
|
548
|
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
533
|
549
|
#init grind
|
534
|
|
-
|
|
550
|
+
|
535
|
551
|
if invert_on:
|
536
|
552
|
invertpos(detectedObjects)
|
537
|
553
|
own['inverting'] = True
|
|
@@ -543,56 +559,53 @@ def main():
|
543
|
559
|
if dist < grind_dist and dropin == 0 and manual == 0 and no_grind == 0 and own['grindoutturn'] == 0 and own['manual'] == 0 and own['gt_cd2'] < 40 and invert_on == False and own['air_mover'] == False and no_grind_pull == 0 and own['last_invert'] == False and own['grindjumpturn'] == 0 and grind_jump == 0 and own['airup'] == 0:
|
544
|
560
|
#print("grinding")
|
545
|
561
|
grind_height_dif = (own.worldPosition[2] - nearestObject.worldPosition[2]) - .287
|
546
|
|
- worldPos = own.worldPosition
|
|
562
|
+ #worldPos = own.worldPosition
|
547
|
563
|
if grind_height_dif > -.05:#02:
|
548
|
564
|
|
549
|
565
|
if own['grinder_rot'] != None:
|
550
|
|
- grot = nearestObject.getAxisVect( [1, 0.0, 0.0]).x
|
|
566
|
+ grot = nearestObject.getAxisVect([1, 0.0, 0.0]).x
|
551
|
567
|
dif = (grot - own['grinder_rot'])
|
552
|
568
|
if dif > .8 or dif < - .8:
|
553
|
569
|
print('skipping grind, angle is', dif)
|
554
|
570
|
skipper = 1
|
555
|
|
-
|
556
|
|
-
|
|
571
|
+
|
|
572
|
+
|
557
|
573
|
#print((grot - own['grinder_rot']), 'grinder_rot')
|
558
|
|
- own['grinder_rot'] = nearestObject.getAxisVect([1,0,0]).x
|
|
574
|
+ own['grinder_rot'] = nearestObject.getAxisVect([1, 0, 0]).x
|
559
|
575
|
if skipper != 1:
|
560
|
|
-
|
561
|
|
- grindvect(nearestObject)
|
|
576
|
+ grindvect(nearestObject)
|
562
|
577
|
grindrotvel(nearestObject)
|
563
|
578
|
grind(nearestObject)
|
564
|
579
|
grindold = True
|
565
|
580
|
own['grindold_timer'] = 0
|
566
|
581
|
own["grindHit"] = True
|
567
|
582
|
own['grindnew_timer'] += 1
|
568
|
|
-
|
569
|
|
-
|
570
|
583
|
if own['grindnew_timer'] < 1:
|
571
|
584
|
if grindTouch.triggered:
|
572
|
585
|
nearpos = nearestObject.worldPosition
|
573
|
586
|
if hitNormal != None:
|
574
|
587
|
stre = .15
|
575
|
|
- own.alignAxisToVect(hitNormal, 2, stre)
|
576
|
|
- #print("align")
|
|
588
|
+ own.alignAxisToVect(hitNormal, 2, stre)
|
|
589
|
+ #print("align")
|
577
|
590
|
#own.worldPosition = [nearpos.x, nearpos.y, nearpos.z + .2975]
|
578
|
|
- #print('new moving world')
|
|
591
|
+ print('new moving world')
|
579
|
592
|
|
580
|
593
|
else:
|
581
|
|
- #grindold = False
|
|
594
|
+ #grindold = False
|
582
|
595
|
own['grindold_timer'] += 1
|
583
|
596
|
own["grindHit"] = False
|
584
|
|
- own['inverting'] = False
|
585
|
|
-
|
|
597
|
+ own['inverting'] = False
|
|
598
|
+
|
586
|
599
|
if own['grindold_timer'] > 5:
|
587
|
600
|
grindold = False
|
588
|
601
|
own['grind_start_frame'] = framenum
|
589
|
602
|
own["grindSound"] = None
|
590
|
|
-
|
|
603
|
+
|
591
|
604
|
if own['grindHit'] == False:
|
592
|
|
- own['grindnew_timer'] = 0
|
593
|
|
-
|
594
|
|
-#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
595
|
|
-
|
|
605
|
+ own['grindnew_timer'] = 0
|
|
606
|
+
|
|
607
|
+#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
608
|
+
|
596
|
609
|
#if you are touching grinder and last_manual is off keep manual off
|
597
|
610
|
if (own['fak_nmanual'] == 1 or own['reg_nmanual'] == 1 or own['fak_manual'] == 1 or own['reg_manual'] == 1) and lastGround == True and grindold == False:
|
598
|
611
|
manual = 1
|
|
@@ -604,15 +617,15 @@ def main():
|
604
|
617
|
if abs(own['pregrind_vely']) > abs(vely) and own['LAST_GRIND'] == 0:
|
605
|
618
|
convely = own['pregrind_vely']
|
606
|
619
|
else:
|
607
|
|
- convely = vely
|
|
620
|
+ convely = vely
|
608
|
621
|
|
609
|
622
|
off = 0
|
610
|
623
|
|
611
|
624
|
if touched == True:
|
612
|
625
|
own["grindTouchobj"] = grindTouch.hitObject
|
613
|
626
|
else:
|
614
|
|
- own["grindTouchobj"] = None
|
615
|
|
-
|
|
627
|
+ own["grindTouchobj"] = None
|
|
628
|
+
|
616
|
629
|
if ray.triggered and dropin == 0:
|
617
|
630
|
lgobj = ray.hitObject
|
618
|
631
|
own['lGobj'] = lgobj
|
|
@@ -620,14 +633,12 @@ def main():
|
620
|
633
|
#prop = obj.get("property", None)
|
621
|
634
|
linVelocity3 = own.getLinearVelocity(True)
|
622
|
635
|
grindpos2 = own["grindpos"]
|
623
|
|
- regboard = "reg_board"
|
624
|
|
- fakboard = "fak_board"
|
625
|
|
- if obj is not None:
|
|
636
|
+ if obj is not None:
|
626
|
637
|
if 'rail' in ray.hitObject:
|
627
|
|
- own["grindSound"] = "rail"
|
|
638
|
+ own["grindSound"] = "rail"
|
628
|
639
|
else:
|
629
|
640
|
own["grindSound"] = "concrete"
|
630
|
|
- own['lGobj'] = lgobj
|
|
641
|
+ own['lGobj'] = lgobj
|
631
|
642
|
else:
|
632
|
643
|
lgobj = "empty"
|
633
|
644
|
own['lGobj'] = lgobj
|
|
@@ -644,7 +655,7 @@ def main():
|
644
|
655
|
if own['grindOld'] == 1 and ray.triggered == 1:
|
645
|
656
|
own['aligntimer'] = own['aligntimer'] - 1
|
646
|
657
|
if own['grindOld'] == 0 and ray.triggered == 0:
|
647
|
|
- own['aligntimer'] = 0
|
|
658
|
+ own['aligntimer'] = 0
|
648
|
659
|
|
649
|
660
|
def invertpos():
|
650
|
661
|
minDist = None
|
|
@@ -654,62 +665,62 @@ def main():
|
654
|
665
|
if (minDist is None or dist < minDist):
|
655
|
666
|
nearestObject = obj
|
656
|
667
|
minDist = dist
|
657
|
|
- vect = nearestObject.getAxisVect( [1.0, 0.0, 0.0])
|
|
668
|
+ vect = nearestObject.getAxisVect([1.0, 0.0, 0.0])
|
658
|
669
|
#own.alignAxisToVect(vect, 0, 0)
|
659
|
670
|
own.worldPosition = [nearestObject.worldPosition.x, nearestObject.worldPosition.y, nearestObject.worldPosition.z +.1]
|
660
|
|
- #own.setLinearVelocity([0, 0.0, 0], 1)
|
661
|
|
-
|
|
671
|
+ #own.setLinearVelocity([0, 0.0, 0], 1)
|
|
672
|
+
|
662
|
673
|
def set_pregrind_vel():
|
663
|
674
|
if grindDar.triggered == False and ray.triggered == False:
|
664
|
675
|
own['pregrind_velx'] = linVelocity2.x
|
665
|
676
|
own['pregrind_vely'] = linVelocity2.y
|
666
|
677
|
own['pregrind_velz'] = linVelocity2.z
|
667
|
|
-
|
|
678
|
+
|
668
|
679
|
def stop_bounce():
|
669
|
680
|
if grindTouch.triggered and no_grind == 0 and grind_jump == 0 and jump_timer < 30:
|
670
|
681
|
linVelocity4 = own.getLinearVelocity(True)
|
671
|
682
|
if linVelocity4.z > 0:
|
672
|
683
|
own.setLinearVelocity([linVelocity4.x, linVelocity4.y, 0], 1)
|
673
|
|
-
|
674
|
|
- if jump_timer < 30 :
|
675
|
|
- own['grind_jump'] = 0
|
|
684
|
+
|
|
685
|
+ if jump_timer < 30:
|
|
686
|
+ own['grind_jump'] = 0
|
676
|
687
|
if grindold == False and ray.triggered:
|
677
|
|
- own['grind_start_frame'] = own['framenum']
|
678
|
|
-
|
|
688
|
+ own['grind_start_frame'] = own['framenum']
|
|
689
|
+
|
679
|
690
|
if grindDar_timer > 0:
|
680
|
691
|
grindDar_timer -= 1
|
681
|
|
- if ray.triggered == False and touched == True and own['footplant_on'] == False and manual == 0 and own['gt_cd2'] < 55 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0 :
|
682
|
|
- obj = grindTouch.hitObject
|
|
692
|
+ if ray.triggered == False and touched == True and own['footplant_on'] == False and manual == 0 and own['gt_cd2'] < 55 and own['grindoutturn'] == 0 and own['grindjumpturn'] == 0:
|
|
693
|
+ obj = grindTouch.hitObject
|
683
|
694
|
try:
|
684
|
695
|
nearpos = obj.worldPosition
|
685
|
696
|
except:
|
686
|
|
- pass
|
687
|
|
- if ray.triggered == False:
|
688
|
|
- own["nogrindsound"] = 1
|
|
697
|
+ pass
|
|
698
|
+ #if ray.triggered == False:
|
|
699
|
+ #own["nogrindsound"] = 1
|
689
|
700
|
def slow_roty():
|
690
|
701
|
#print(abs(roty - own['last_roty']))
|
691
|
|
- #print(roty)
|
692
|
|
-
|
|
702
|
+ #print(roty)
|
|
703
|
+
|
693
|
704
|
#if roted > 5:
|
694
|
705
|
#pass
|
695
|
|
- #align slow
|
|
706
|
+ #align slow
|
696
|
707
|
constraint = cont.actuators['gConstraint']
|
697
|
708
|
if (own['framenum'] - own['grind_start_frame'] < 40) and touched == 1:
|
698
|
|
- #print('limit rot')
|
|
709
|
+ #print('limit rot')
|
699
|
710
|
#constraint.damp = 80
|
700
|
711
|
#else:
|
701
|
712
|
#constraint.damp = 30
|
702
|
713
|
#constraint.rotDamp = 80
|
703
|
|
- cont.activate(constraint)
|
|
714
|
+ cont.activate(constraint)
|
704
|
715
|
else:
|
705
|
|
- cont.deactivate(constraint)
|
706
|
|
- timer()
|
|
716
|
+ cont.deactivate(constraint)
|
|
717
|
+ timer()
|
707
|
718
|
aligntimer()
|
708
|
|
- stop_bounce()
|
|
719
|
+ stop_bounce()
|
709
|
720
|
slow_roty()
|
710
|
|
-
|
711
|
|
-
|
712
|
|
- own['grindOld'] = grindold
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+ own['grindOld'] = grindold
|
713
|
724
|
own['test'] = test
|
714
|
725
|
own['grindTrackObj'] = nearestObject
|
715
|
726
|
own['grindDar_hit'] = grindDar.positive
|