|
@@ -1,548 +1,550 @@
|
1
|
|
-#"""
|
2
|
|
-#Modified BGE Gameplay Recorder Version 2
|
3
|
|
-#originally written by Nicholas Anderson, aka Red Frost Games.
|
4
|
|
-#"""
|
|
1
|
+def main():
|
5
|
2
|
|
6
|
|
-#####Tweakables###############
|
7
|
|
-#Watch out! These numbers might bite!
|
8
|
|
-frame_rate = 60 #Set this to the framerate of your game.
|
9
|
|
-optimization = 1 #An integer, must be at least 1! Higher value will make a smaller saved file size. I do not reccomend setting it to anything other than 1 though.
|
10
|
|
-recording_cutoff = 7300 #3600 #Frames at which the oldest recorded frame will be deleted. 0 is no cutoff.
|
11
|
|
-recorder_state = 1 #This is the main state of the recorder object. State will be reverted to this value when the user breaks out of the playback.
|
12
|
|
-allow_playback_break = True #Allow the player to resume playing from the position in the recording.
|
13
|
|
-#####Sensor names#############
|
14
|
|
-record_sensor = "Record"
|
15
|
|
-save_recording_sensor = "Save"
|
16
|
|
-load_recording_sensor = "Load"
|
17
|
|
-track_left_sensor = "Left"
|
18
|
|
-track_right_sensor = "Right"
|
19
|
|
-break_sensor = "Break"
|
20
|
|
-##############################
|
|
3
|
+ #"""
|
|
4
|
+ #Modified BGE Gameplay Recorder Version 2
|
|
5
|
+ #originally written by Nicholas Anderson, aka Red Frost Games.
|
|
6
|
+ #"""
|
21
|
7
|
|
22
|
|
-from bge import logic
|
23
|
|
-import Record
|
24
|
|
-import SortData
|
|
8
|
+ #####Tweakables###############
|
|
9
|
+ #Watch out! These numbers might bite!
|
|
10
|
+ frame_rate = 60 #Set this to the framerate of your game.
|
|
11
|
+ optimization = 1 #An integer, must be at least 1! Higher value will make a smaller saved file size. I do not reccomend setting it to anything other than 1 though.
|
|
12
|
+ recording_cutoff = 7300 #3600 #Frames at which the oldest recorded frame will be deleted. 0 is no cutoff.
|
|
13
|
+ recorder_state = 1 #This is the main state of the recorder object. State will be reverted to this value when the user breaks out of the playback.
|
|
14
|
+ allow_playback_break = True #Allow the player to resume playing from the position in the recording.
|
|
15
|
+ #####Sensor names#############
|
|
16
|
+ record_sensor = "Record"
|
|
17
|
+ save_recording_sensor = "Save"
|
|
18
|
+ load_recording_sensor = "Load"
|
|
19
|
+ track_left_sensor = "Left"
|
|
20
|
+ track_right_sensor = "Right"
|
|
21
|
+ break_sensor = "Break"
|
|
22
|
+ ##############################
|
25
|
23
|
|
26
|
|
-cont = logic.getCurrentController()
|
27
|
|
-own = cont.owner
|
|
24
|
+ from bge import logic
|
|
25
|
+ import Record
|
|
26
|
+ import SortData
|
28
|
27
|
|
29
|
|
-cont.sensors[record_sensor].skippedTicks = optimization
|
30
|
|
-dict = logic.globalDict
|
|
28
|
+ cont = logic.getCurrentController()
|
|
29
|
+ own = cont.owner
|
31
|
30
|
|
32
|
|
-#dict['recorder_on'] = recorder_on
|
33
|
|
-recorder_on = dict.get('recorder_on')
|
34
|
|
-own['recorder_on'] = recorder_on
|
35
|
|
-#print("recorder on: ", recorder_on)
|
|
31
|
+ cont.sensors[record_sensor].skippedTicks = optimization
|
|
32
|
+ dict = logic.globalDict
|
36
|
33
|
|
37
|
|
-if recorder_on == 1:
|
38
|
|
- #----
|
39
|
|
- scene = logic.getCurrentScene()
|
40
|
|
- scene_list = logic.getSceneList()
|
41
|
|
- camList = scene.cameras
|
42
|
|
- followcam = camList["followcam"]
|
43
|
|
- freecam = camList["freecam"]
|
44
|
|
- skater = scene.objects["Char4"]
|
45
|
|
- cube = scene.objects["control_cube.002"]
|
46
|
|
- deck = scene.objects["deck"]
|
47
|
|
- trucks = scene.objects["trucks"]
|
48
|
|
- replay_cam_axis = own['replay_cam_axis']
|
49
|
|
- cam = own.actuators['Camera']
|
50
|
|
- #----
|
51
|
|
- joybutsens = "joyBut"
|
52
|
|
- #butt = cont.sensors[joybutsens]
|
53
|
|
- #aXis = cont.sensors["joysticksens"]
|
54
|
|
- #bk_but = 4
|
55
|
|
- back_on = dict['bkBut']
|
56
|
|
- #a_but = 0
|
57
|
|
- a_on = dict['aBut']
|
58
|
|
- #b_but = 1
|
59
|
|
- b_on = dict['bBut']
|
60
|
|
- #print(a on)
|
61
|
|
- last_back = own['last_back_but']
|
62
|
|
- #last_back = own['last_a_but']
|
63
|
|
-# reduction = 400000
|
64
|
|
-# axisTh = 0.03
|
65
|
|
-# lt = 4
|
66
|
|
-# rt = 5
|
67
|
|
-# lts_pr = 7
|
68
|
|
-# rts_pr = 8
|
|
34
|
+ #dict['recorder_on'] = recorder_on
|
|
35
|
+ recorder_on = dict.get('recorder_on')
|
|
36
|
+ own['recorder_on'] = recorder_on
|
|
37
|
+ #print("recorder on: ", recorder_on)
|
69
|
38
|
|
70
|
|
-# lar_lts = 0
|
71
|
|
-# uad_lts = 1
|
72
|
|
-# lar_rts = 2
|
73
|
|
-# uad_rts = 3
|
74
|
|
- #lts_pr = 7
|
75
|
|
- #rts_pr = 8
|
76
|
|
-# lTrig = aXis.axisValues[lt] / reduction
|
77
|
|
-# rTrig = aXis.axisValues[rt] / reduction
|
78
|
|
-# lLR = aXis.axisValues[lar_lts] / reduction
|
79
|
|
-# lUD = aXis.axisValues[uad_lts] / reduction
|
80
|
|
-# rLR = aXis.axisValues[lar_rts] / reduction
|
81
|
|
-# rUD = aXis.axisValues[uad_rts] / reduction
|
82
|
|
-# ltsBut = butt.getButtonStatus(lts_pr)
|
83
|
|
-# rtsBut = butt.getButtonStatus(rts_pr)
|
84
|
|
-#
|
85
|
|
- lLR = dict['lLR']
|
86
|
|
- lUD = dict['lUD']
|
87
|
|
- rLR = dict['rLR']
|
88
|
|
- rUD = dict['rUD']
|
89
|
|
- lTrig = dict['lTrig']
|
90
|
|
- rTrig = dict['rTrig']
|
91
|
|
- aBut = dict['aBut']
|
92
|
|
- bBut = dict['bBut']
|
93
|
|
- xBut = dict['xBut']
|
94
|
|
- yBut = dict['yBut']
|
95
|
|
- lBump = dict['lBump']
|
96
|
|
- rBump = dict['rBump']
|
97
|
|
- bkBut = dict['bkBut']
|
98
|
|
- stBut = dict['stBut']
|
99
|
|
- xbBut = dict['xbBut']
|
100
|
|
- ltsBut = dict['ltsBut']
|
101
|
|
- rtsBut = dict['rtsBut']
|
102
|
|
- ldPad = dict['ldPad']
|
103
|
|
- rdPad = dict['rdPad']
|
104
|
|
- udPad = dict['udPad']
|
105
|
|
- ddPad = dict['ddPad']
|
106
|
|
-
|
107
|
|
-
|
108
|
|
-
|
109
|
|
- #trigs results range 0 - .08
|
110
|
|
- #print(lTrig, rTrig)
|
|
39
|
+ if recorder_on == 1:
|
|
40
|
+ #----
|
|
41
|
+ scene = logic.getCurrentScene()
|
|
42
|
+ scene_list = logic.getSceneList()
|
|
43
|
+ camList = scene.cameras
|
|
44
|
+ followcam = camList["followcam"]
|
|
45
|
+ freecam = camList["freecam"]
|
|
46
|
+ skater = scene.objects["Char4"]
|
|
47
|
+ cube = scene.objects["control_cube.002"]
|
|
48
|
+ deck = scene.objects["deck"]
|
|
49
|
+ trucks = scene.objects["trucks"]
|
|
50
|
+ replay_cam_axis = own['replay_cam_axis']
|
|
51
|
+ cam = own.actuators['Camera']
|
|
52
|
+ #----
|
|
53
|
+ joybutsens = "joyBut"
|
|
54
|
+ #butt = cont.sensors[joybutsens]
|
|
55
|
+ #aXis = cont.sensors["joysticksens"]
|
|
56
|
+ #bk_but = 4
|
|
57
|
+ back_on = dict['bkBut']
|
|
58
|
+ #a_but = 0
|
|
59
|
+ a_on = dict['aBut']
|
|
60
|
+ #b_but = 1
|
|
61
|
+ b_on = dict['bBut']
|
|
62
|
+ #print(a on)
|
|
63
|
+ last_back = own['last_back_but']
|
|
64
|
+ #last_back = own['last_a_but']
|
|
65
|
+ # reduction = 400000
|
|
66
|
+ # axisTh = 0.03
|
|
67
|
+ # lt = 4
|
|
68
|
+ # rt = 5
|
|
69
|
+ # lts_pr = 7
|
|
70
|
+ # rts_pr = 8
|
111
|
71
|
|
112
|
|
- #if cont.sensors[record_sensor].positive:
|
113
|
|
- if own["playback"] != True:
|
114
|
|
- Record.main(recording_cutoff)
|
115
|
|
-
|
116
|
|
- if cont.sensors[save_recording_sensor].positive:
|
117
|
|
- SortData.writeData.saveAll()
|
118
|
|
-
|
119
|
|
- #if cont.sensors[load_recording_sensor].positive or (cube["sel"] == 1 and cube["last_sel"] == 0):
|
120
|
|
- if own['back_state'] == 1 and back_on == 1 and last_back == 0:
|
121
|
|
- cube["last_sel"] == 1
|
122
|
|
- SortData.writeData.saveAll()
|
123
|
|
- own["playback"] = True
|
124
|
|
- own["playbackBroken"] = False
|
125
|
|
- freecam.worldPosition = own.worldPosition
|
126
|
|
- followcam.worldPosition = own.worldPosition
|
|
72
|
+ # lar_lts = 0
|
|
73
|
+ # uad_lts = 1
|
|
74
|
+ # lar_rts = 2
|
|
75
|
+ # uad_rts = 3
|
|
76
|
+ #lts_pr = 7
|
|
77
|
+ #rts_pr = 8
|
|
78
|
+ # lTrig = aXis.axisValues[lt] / reduction
|
|
79
|
+ # rTrig = aXis.axisValues[rt] / reduction
|
|
80
|
+ # lLR = aXis.axisValues[lar_lts] / reduction
|
|
81
|
+ # lUD = aXis.axisValues[uad_lts] / reduction
|
|
82
|
+ # rLR = aXis.axisValues[lar_rts] / reduction
|
|
83
|
+ # rUD = aXis.axisValues[uad_rts] / reduction
|
|
84
|
+ # ltsBut = butt.getButtonStatus(lts_pr)
|
|
85
|
+ # rtsBut = butt.getButtonStatus(rts_pr)
|
|
86
|
+ #
|
|
87
|
+ lLR = dict['lLR']
|
|
88
|
+ lUD = dict['lUD']
|
|
89
|
+ rLR = dict['rLR']
|
|
90
|
+ rUD = dict['rUD']
|
|
91
|
+ lTrig = dict['lTrig']
|
|
92
|
+ rTrig = dict['rTrig']
|
|
93
|
+ aBut = dict['aBut']
|
|
94
|
+ bBut = dict['bBut']
|
|
95
|
+ xBut = dict['xBut']
|
|
96
|
+ yBut = dict['yBut']
|
|
97
|
+ lBump = dict['lBump']
|
|
98
|
+ rBump = dict['rBump']
|
|
99
|
+ bkBut = dict['bkBut']
|
|
100
|
+ stBut = dict['stBut']
|
|
101
|
+ xbBut = dict['xbBut']
|
|
102
|
+ ltsBut = dict['ltsBut']
|
|
103
|
+ rtsBut = dict['rtsBut']
|
|
104
|
+ ldPad = dict['ldPad']
|
|
105
|
+ rdPad = dict['rdPad']
|
|
106
|
+ udPad = dict['udPad']
|
|
107
|
+ ddPad = dict['ddPad']
|
|
108
|
+
|
127
|
109
|
|
|
110
|
+
|
|
111
|
+ #trigs results range 0 - .08
|
|
112
|
+ #print(lTrig, rTrig)
|
128
|
113
|
|
129
|
|
- if own["playback"]:
|
130
|
|
- Record.loadData()
|
131
|
|
- #..................
|
132
|
|
- if cont.sensors[track_left_sensor].positive:
|
133
|
|
- own["objIndex"] -= 2
|
134
|
|
- logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
|
135
|
|
-
|
136
|
|
- if cont.sensors[track_right_sensor].positive:
|
137
|
|
- own["objIndex"] += 2
|
138
|
|
- logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
|
|
114
|
+ #if cont.sensors[record_sensor].positive:
|
|
115
|
+ if own["playback"] != True:
|
|
116
|
+ Record.main(recording_cutoff, cube)
|
|
117
|
+
|
|
118
|
+ if cont.sensors[save_recording_sensor].positive:
|
|
119
|
+ SortData.writeData.saveAll()
|
|
120
|
+
|
|
121
|
+ #if cont.sensors[load_recording_sensor].positive or (cube["sel"] == 1 and cube["last_sel"] == 0):
|
|
122
|
+ if own['back_state'] == 1 and back_on == 1 and last_back == 0:
|
|
123
|
+ cube["last_sel"] == 1
|
|
124
|
+ SortData.writeData.saveAll()
|
|
125
|
+ own["playback"] = True
|
|
126
|
+ own["playbackBroken"] = False
|
|
127
|
+ freecam.worldPosition = own.worldPosition
|
|
128
|
+ followcam.worldPosition = own.worldPosition
|
|
129
|
+
|
139
|
130
|
|
140
|
|
- if own["playback"] == True:
|
141
|
|
- if rTrig > .01 and rTrig < .02:
|
142
|
|
- own["objIndex"] += 2
|
143
|
|
- logic.setLogicTicRate(frame_rate*.5)
|
144
|
|
- if (rTrig >= .02 and rTrig < .06) or own['loop_play'] == 1:
|
145
|
|
- own["objIndex"] += 2
|
146
|
|
- logic.setLogicTicRate(frame_rate*1)
|
147
|
|
- #print(own['objIndex'])
|
148
|
|
- if rTrig >= .06 and rTrig < .09:
|
149
|
|
- own["objIndex"] += 2
|
150
|
|
- logic.setLogicTicRate(frame_rate*1.5)
|
151
|
|
- if lTrig > .01 and lTrig < .02:
|
|
131
|
+ if own["playback"]:
|
|
132
|
+ Record.loadData()
|
|
133
|
+ #..................
|
|
134
|
+ if cont.sensors[track_left_sensor].positive:
|
152
|
135
|
own["objIndex"] -= 2
|
153
|
|
- logic.setLogicTicRate(frame_rate*.5)
|
154
|
|
- if lTrig >= .02 and lTrig < .06:
|
155
|
|
- own["objIndex"] -= 2
|
156
|
|
- logic.setLogicTicRate(frame_rate*1)
|
157
|
|
- if lTrig >= .06 and lTrig < .09:
|
158
|
|
- if own['loop_play'] == 1:
|
159
|
|
- own["objIndex"] -= 6
|
160
|
|
- #logic.setLogicTicRate(frame_rate*1.5)
|
161
|
|
- else:
|
|
136
|
+ logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
|
|
137
|
+
|
|
138
|
+ if cont.sensors[track_right_sensor].positive:
|
|
139
|
+ own["objIndex"] += 2
|
|
140
|
+ logic.setLogicTicRate(frame_rate*own["playbackSpeed"])
|
|
141
|
+
|
|
142
|
+ if own["playback"] == True:
|
|
143
|
+ if rTrig > .01 and rTrig < .02:
|
|
144
|
+ own["objIndex"] += 2
|
|
145
|
+ logic.setLogicTicRate(frame_rate*.5)
|
|
146
|
+ if (rTrig >= .02 and rTrig < .06) or own['loop_play'] == 1:
|
|
147
|
+ own["objIndex"] += 2
|
|
148
|
+ logic.setLogicTicRate(frame_rate*1)
|
|
149
|
+ #print(own['objIndex'])
|
|
150
|
+ if rTrig >= .06 and rTrig < .09:
|
|
151
|
+ own["objIndex"] += 2
|
|
152
|
+ logic.setLogicTicRate(frame_rate*1.5)
|
|
153
|
+ if lTrig > .01 and lTrig < .02:
|
162
|
154
|
own["objIndex"] -= 2
|
163
|
|
- logic.setLogicTicRate(frame_rate*1.5)
|
164
|
|
- if b_on == True:
|
165
|
|
- print("bbut_on")
|
166
|
|
- own['objIndex'] = 0
|
167
|
|
- own['valueIndex'] = 0
|
168
|
|
- logic.setLogicTicRate(frame_rate*1)
|
|
155
|
+ logic.setLogicTicRate(frame_rate*.5)
|
|
156
|
+ if lTrig >= .02 and lTrig < .06:
|
|
157
|
+ own["objIndex"] -= 2
|
|
158
|
+ logic.setLogicTicRate(frame_rate*1)
|
|
159
|
+ if lTrig >= .06 and lTrig < .09:
|
|
160
|
+ if own['loop_play'] == 1:
|
|
161
|
+ own["objIndex"] -= 6
|
|
162
|
+ #logic.setLogicTicRate(frame_rate*1.5)
|
|
163
|
+ else:
|
|
164
|
+ own["objIndex"] -= 2
|
|
165
|
+ logic.setLogicTicRate(frame_rate*1.5)
|
|
166
|
+ if b_on == True:
|
|
167
|
+ print("bbut_on")
|
|
168
|
+ own['objIndex'] = 0
|
|
169
|
+ own['valueIndex'] = 0
|
|
170
|
+ logic.setLogicTicRate(frame_rate*1)
|
169
|
171
|
|
170
|
|
- #....................
|
171
|
|
- if allow_playback_break:
|
|
172
|
+ #....................
|
|
173
|
+ if allow_playback_break:
|
172
|
174
|
|
173
|
|
- if own['back_state'] == 0 and back_on == 1 and last_back == 0:
|
174
|
|
- own["playbackBroken"] = True
|
175
|
|
- own["playback"] = False
|
176
|
|
- #print("break - add hud, remove stance (back_state == False)")
|
177
|
|
- #cont.activate(own.actuators['add_hud'])
|
178
|
|
- #cont.activate(own.actuators['remove_stance'])
|
179
|
|
- #removescene = cont.actuators["remove_hud"]
|
180
|
|
- #removescene.scene = "replay_HUD"
|
181
|
|
- #addscene = cont.actuators["add_hud"]
|
182
|
|
- #addscene.scene = "stance"
|
183
|
|
- #cont.activate(addscene)
|
184
|
|
- #cont.activate(removescene)
|
185
|
|
- elif own["playbackBroken"] and back_on == 0:
|
186
|
|
- Record.breakOut()
|
187
|
|
- #cont.activate(own.actuators['remove_hud'])
|
188
|
|
- #cont.activate(own.actuators['add_stance'])
|
189
|
|
- #addscene = cont.actuators["add_hud"]
|
190
|
|
- #addscene.scene = "replay_HUD"
|
191
|
|
- #removescene = cont.actuators["remove_hud"]
|
192
|
|
- #removescene.scene = "stance"
|
193
|
|
- #cont.activate(addscene)
|
194
|
|
- #cont.activate(removescene)
|
195
|
|
-
|
196
|
|
- logic.setLogicTicRate(frame_rate)
|
197
|
|
- #set value index
|
198
|
|
- own.state = recorder_state
|
199
|
|
- own["playbackBroken"] = False
|
200
|
|
- skater.stopAction(9999)
|
201
|
|
- deck.stopAction(9999)
|
202
|
|
- trucks.stopAction(9999)
|
203
|
|
- cont.activate(own.actuators['replayCam'])
|
204
|
|
- print("unbreak")
|
205
|
|
- own['loop_play'] = 0
|
206
|
|
- #own['valueIndex'] = 0
|
207
|
|
- #own["objIndex"] += 2
|
208
|
|
- #logic.setLogicTicRate(frame_rate*1)
|
209
|
|
- #own['objectIndex'] = 0
|
210
|
|
- #print("valueIndex = ", own['valueIndex'])
|
211
|
|
- if back_on == 1 and own['back_but'] == 0:
|
212
|
|
- print("change back state")
|
213
|
|
- if own['back_state'] == True:
|
214
|
|
- own['back_state'] = False
|
215
|
|
- #elif own['back_state'] == False:
|
216
|
|
- else:
|
217
|
|
- own['back_state'] = True
|
218
|
|
-###
|
219
|
|
- if own['last_playback'] != own['playback']:
|
220
|
|
- if own['last_playback'] == True:
|
221
|
|
- cont.activate(own.actuators['remove_hud'])
|
222
|
|
- cont.activate(own.actuators['add_stance'])
|
223
|
|
- own['camnum'] = 0
|
224
|
|
- cam = camList["Camera.003"]
|
225
|
|
- scene.active_camera = cam
|
226
|
|
- print("turning replay off", own['playback'])
|
|
175
|
+ if own['back_state'] == 0 and back_on == 1 and last_back == 0:
|
|
176
|
+ own["playbackBroken"] = True
|
|
177
|
+ own["playback"] = False
|
|
178
|
+ #print("break - add hud, remove stance (back_state == False)")
|
|
179
|
+ #cont.activate(own.actuators['add_hud'])
|
|
180
|
+ #cont.activate(own.actuators['remove_stance'])
|
|
181
|
+ #removescene = cont.actuators["remove_hud"]
|
|
182
|
+ #removescene.scene = "replay_HUD"
|
|
183
|
+ #addscene = cont.actuators["add_hud"]
|
|
184
|
+ #addscene.scene = "stance"
|
|
185
|
+ #cont.activate(addscene)
|
|
186
|
+ #cont.activate(removescene)
|
|
187
|
+ elif own["playbackBroken"] and back_on == 0:
|
|
188
|
+ Record.breakOut()
|
|
189
|
+ #cont.activate(own.actuators['remove_hud'])
|
|
190
|
+ #cont.activate(own.actuators['add_stance'])
|
|
191
|
+ #addscene = cont.actuators["add_hud"]
|
|
192
|
+ #addscene.scene = "replay_HUD"
|
|
193
|
+ #removescene = cont.actuators["remove_hud"]
|
|
194
|
+ #removescene.scene = "stance"
|
|
195
|
+ #cont.activate(addscene)
|
|
196
|
+ #cont.activate(removescene)
|
|
197
|
+
|
|
198
|
+ logic.setLogicTicRate(frame_rate)
|
|
199
|
+ #set value index
|
|
200
|
+ own.state = recorder_state
|
|
201
|
+ own["playbackBroken"] = False
|
|
202
|
+ skater.stopAction(9999)
|
|
203
|
+ deck.stopAction(9999)
|
|
204
|
+ trucks.stopAction(9999)
|
|
205
|
+ cont.activate(own.actuators['replayCam'])
|
|
206
|
+ print("unbreak")
|
|
207
|
+ own['loop_play'] = 0
|
|
208
|
+ #own['valueIndex'] = 0
|
|
209
|
+ #own["objIndex"] += 2
|
|
210
|
+ #logic.setLogicTicRate(frame_rate*1)
|
|
211
|
+ #own['objectIndex'] = 0
|
|
212
|
+ #print("valueIndex = ", own['valueIndex'])
|
|
213
|
+ if back_on == 1 and own['back_but'] == 0:
|
|
214
|
+ print("change back state")
|
|
215
|
+ if own['back_state'] == True:
|
|
216
|
+ own['back_state'] = False
|
|
217
|
+ #elif own['back_state'] == False:
|
|
218
|
+ else:
|
|
219
|
+ own['back_state'] = True
|
|
220
|
+ ###
|
|
221
|
+ if own['last_playback'] != own['playback']:
|
|
222
|
+ if own['last_playback'] == True:
|
|
223
|
+ cont.activate(own.actuators['remove_hud'])
|
|
224
|
+ cont.activate(own.actuators['add_stance'])
|
|
225
|
+ own['camnum'] = 0
|
|
226
|
+ cam = camList["Camera.003"]
|
|
227
|
+ scene.active_camera = cam
|
|
228
|
+ print("turning replay off", own['playback'])
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+ if own['last_playback'] == False:
|
|
232
|
+ print("turning replay on", own['playback'])
|
|
233
|
+ cont.activate(own.actuators['add_hud'])
|
|
234
|
+ cont.activate(own.actuators['remove_stance'])
|
|
235
|
+ own['objIndex'] = 0
|
|
236
|
+ own['valueIndex'] = 3
|
|
237
|
+ logic.setLogicTicRate(frame_rate*1)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+ ####
|
|
241
|
+ if a_on == 1 and own['a_but'] == False:
|
|
242
|
+ if own['loop_play'] == 1:
|
|
243
|
+ own['loop_play'] = 0
|
|
244
|
+ else:
|
|
245
|
+ own['loop_play'] = 1
|
|
246
|
+ if rLR > .05 and own["playback"]:
|
|
247
|
+ act = cont.actuators["replayCam"]
|
|
248
|
+ if rLR > .07:
|
|
249
|
+ act.dLoc = [ .06, 0.0, 0.0]
|
|
250
|
+ else:
|
|
251
|
+ act.dLoc = [ .03, 0.0, 0.0]
|
|
252
|
+ #cont.deactivate(own.actuators['Camera'])
|
|
253
|
+ cont.activate(own.actuators['replayCam'])
|
|
254
|
+ #print("move")
|
|
255
|
+ elif rLR < -.05 and own["playback"]:
|
|
256
|
+ act = cont.actuators["replayCam"]
|
|
257
|
+ if rLR < -.07:
|
|
258
|
+ act.dLoc = [ -.06, 0.0, 0.0]
|
|
259
|
+ else:
|
|
260
|
+ act.dLoc = [ -.03, 0.0, 0.0]
|
|
261
|
+ #cont.deactivate(own.actuators['Camera'])
|
|
262
|
+ #act.damping = 6
|
|
263
|
+ cont.activate(own.actuators['replayCam'])
|
|
264
|
+ #print("move")
|
|
265
|
+ else:
|
|
266
|
+ #pass
|
|
267
|
+ cont.deactivate(own.actuators['replayCam'])
|
|
268
|
+ #cont.activate(own.actuators['Camera'])
|
|
269
|
+ #print("back state: ", own['back_state'], "last_back_but: ", own['last_back_but'], "back_but :", own['back_but'])
|
|
270
|
+ #integer
|
|
271
|
+ #
|
|
272
|
+ #0 = +X axis
|
|
273
|
+ #
|
|
274
|
+ #1 = +Y axis
|
|
275
|
+ #
|
|
276
|
+ #2 = +Z axis
|
|
277
|
+ #
|
|
278
|
+ #3 = -X axis
|
|
279
|
+ #
|
|
280
|
+ #4 = -Y axis
|
|
281
|
+ #
|
|
282
|
+ #5 = -Z axis
|
|
283
|
+ # if rLR > .05 and own["playback"]:
|
|
284
|
+ # if own['last_rtsBut'] == True and rtsBut == False:
|
|
285
|
+ # if replay_cam_axis == 0:
|
|
286
|
+ # replay_cam_axis = 1
|
|
287
|
+ # elif replay_cam_axis == 1:
|
|
288
|
+ # replay_cam_axis = 3
|
|
289
|
+ # elif replay_cam_axis == 3 :
|
|
290
|
+ # replay_cam_axis = 4
|
|
291
|
+ # elif replay_cam_axis == 4:
|
|
292
|
+ # replay_cam_axis = 0
|
|
293
|
+ # cam.axis = replay_cam_axis
|
|
294
|
+ # cont.activate(cam)
|
|
295
|
+ # print("set replay_cam_axis: ", replay_cam_axis)
|
|
296
|
+ # own['replay_cam_axis'] = replay_cam_axis
|
|
297
|
+ if own['last_ltsBut'] == True and ltsBut == False and own['playback']:
|
|
298
|
+ # get camera named SecurityCam
|
|
299
|
+ if own['camnum'] == 1:
|
|
300
|
+ own['camnum'] = 2
|
|
301
|
+ elif own['camnum'] == 0:
|
|
302
|
+ own['camnum'] = 1
|
|
303
|
+ elif own['camnum'] == 2:
|
|
304
|
+ own['camnum'] = 0
|
|
305
|
+ if own['last_rtsBut'] == True and rtsBut == False and own['playback']:
|
|
306
|
+ # get camera named SecurityCam
|
|
307
|
+ if "replay_HUD" in scene_list:
|
|
308
|
+ cont.activate(own.actuators['remove_hud'])
|
|
309
|
+ else:
|
|
310
|
+ cont.activate(own.actuators['add_hud'])
|
|
311
|
+ if own['camnum'] == 1 and own['playback']:
|
227
|
312
|
|
228
|
|
-
|
229
|
|
- if own['last_playback'] == False:
|
230
|
|
- print("turning replay on", own['playback'])
|
231
|
|
- cont.activate(own.actuators['add_hud'])
|
232
|
|
- cont.activate(own.actuators['remove_stance'])
|
233
|
|
- own['objIndex'] = 0
|
234
|
|
- own['valueIndex'] = 3
|
235
|
|
- logic.setLogicTicRate(frame_rate*1)
|
236
|
|
-
|
237
|
|
-
|
238
|
|
-####
|
239
|
|
- if a_on == 1 and own['a_but'] == False:
|
240
|
|
- if own['loop_play'] == 1:
|
241
|
|
- own['loop_play'] = 0
|
242
|
|
- else:
|
243
|
|
- own['loop_play'] = 1
|
244
|
|
- if rLR > .05 and own["playback"]:
|
245
|
|
- act = cont.actuators["replayCam"]
|
246
|
|
- if rLR > .07:
|
247
|
|
- act.dLoc = [ .06, 0.0, 0.0]
|
248
|
|
- else:
|
249
|
|
- act.dLoc = [ .03, 0.0, 0.0]
|
250
|
|
- #cont.deactivate(own.actuators['Camera'])
|
251
|
|
- cont.activate(own.actuators['replayCam'])
|
252
|
|
- #print("move")
|
253
|
|
- elif rLR < -.05 and own["playback"]:
|
254
|
|
- act = cont.actuators["replayCam"]
|
255
|
|
- if rLR < -.07:
|
256
|
|
- act.dLoc = [ -.06, 0.0, 0.0]
|
257
|
|
- else:
|
258
|
|
- act.dLoc = [ -.03, 0.0, 0.0]
|
259
|
|
- #cont.deactivate(own.actuators['Camera'])
|
260
|
|
- #act.damping = 6
|
261
|
|
- cont.activate(own.actuators['replayCam'])
|
262
|
|
- #print("move")
|
263
|
|
- else:
|
264
|
|
- #pass
|
265
|
|
- cont.deactivate(own.actuators['replayCam'])
|
266
|
|
- #cont.activate(own.actuators['Camera'])
|
267
|
|
- #print("back state: ", own['back_state'], "last_back_but: ", own['last_back_but'], "back_but :", own['back_but'])
|
268
|
|
- #integer
|
269
|
|
- #
|
270
|
|
- #0 = +X axis
|
271
|
|
- #
|
272
|
|
- #1 = +Y axis
|
273
|
|
- #
|
274
|
|
- #2 = +Z axis
|
275
|
|
- #
|
276
|
|
- #3 = -X axis
|
277
|
|
- #
|
278
|
|
- #4 = -Y axis
|
279
|
|
- #
|
280
|
|
- #5 = -Z axis
|
281
|
|
-# if rLR > .05 and own["playback"]:
|
282
|
|
-# if own['last_rtsBut'] == True and rtsBut == False:
|
283
|
|
-# if replay_cam_axis == 0:
|
284
|
|
-# replay_cam_axis = 1
|
285
|
|
-# elif replay_cam_axis == 1:
|
286
|
|
-# replay_cam_axis = 3
|
287
|
|
-# elif replay_cam_axis == 3 :
|
288
|
|
-# replay_cam_axis = 4
|
289
|
|
-# elif replay_cam_axis == 4:
|
290
|
|
-# replay_cam_axis = 0
|
291
|
|
-# cam.axis = replay_cam_axis
|
292
|
|
-# cont.activate(cam)
|
293
|
|
-# print("set replay_cam_axis: ", replay_cam_axis)
|
294
|
|
-# own['replay_cam_axis'] = replay_cam_axis
|
295
|
|
- if own['last_ltsBut'] == True and ltsBut == False and own['playback']:
|
296
|
|
- # get camera named SecurityCam
|
297
|
|
- if own['camnum'] == 1:
|
298
|
|
- own['camnum'] = 2
|
299
|
|
- elif own['camnum'] == 0:
|
300
|
|
- own['camnum'] = 1
|
301
|
|
- elif own['camnum'] == 2:
|
302
|
|
- own['camnum'] = 0
|
303
|
|
- if own['last_rtsBut'] == True and rtsBut == False and own['playback']:
|
304
|
|
- # get camera named SecurityCam
|
305
|
|
- if "replay_HUD" in scene_list:
|
306
|
|
- cont.activate(own.actuators['remove_hud'])
|
307
|
|
- else:
|
308
|
|
- cont.activate(own.actuators['add_hud'])
|
309
|
|
- if own['camnum'] == 1 and own['playback']:
|
310
|
|
-
|
311
|
|
- scene.active_camera = followcam
|
312
|
|
- #################
|
313
|
|
- camspeed1 = .04 #.015
|
314
|
|
- camspeed2 = .1 #.055
|
315
|
|
- camrot1 = .02 #.005
|
316
|
|
- camrot2 = .04 #.02
|
317
|
|
- #up
|
318
|
|
- if lUD < -0.080:
|
319
|
|
- followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
|
320
|
|
- cont.activate(followcam.actuators["up"])
|
321
|
|
- #print("fastup")
|
322
|
|
- else:
|
323
|
|
- cont.deactivate(followcam.actuators["up"])
|
324
|
|
-# #down
|
325
|
|
- if lUD > .080:
|
326
|
|
- followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
|
327
|
|
- cont.activate(followcam.actuators["down"])
|
328
|
|
- else:
|
329
|
|
- cont.deactivate(followcam.actuators["down"])
|
330
|
|
-# #left
|
331
|
|
- if lLR < -0.080:
|
332
|
|
- followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
|
333
|
|
- cont.activate(followcam.actuators["left"])
|
334
|
|
- else:
|
335
|
|
- cont.deactivate(followcam.actuators["left"])
|
336
|
|
-# #right
|
337
|
|
- if lLR > 0.080:
|
338
|
|
- followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
|
339
|
|
- cont.activate(followcam.actuators["right"])
|
340
|
|
- else:
|
341
|
|
- cont.deactivate(followcam.actuators["right"])
|
342
|
|
- #up
|
343
|
|
- if rUD < -0.080:
|
344
|
|
- followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
|
345
|
|
- cont.activate(followcam.actuators["rotup"])
|
346
|
|
- #print("uppppppppppppppppppppppppppp")
|
347
|
|
- else:
|
348
|
|
- cont.deactivate(followcam.actuators["rotup"])
|
349
|
|
-# #down
|
350
|
|
- if rUD > .080:
|
351
|
|
- followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
|
352
|
|
- cont.activate(followcam.actuators["rotdown"])
|
353
|
|
- else:
|
354
|
|
- cont.deactivate(followcam.actuators["rotdown"])
|
355
|
|
-# #left
|
356
|
|
- if rLR < -0.080:
|
357
|
|
- followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
|
358
|
|
- cont.activate(followcam.actuators["rotleft"])
|
359
|
|
- else:
|
360
|
|
- cont.deactivate(followcam.actuators["rotleft"])
|
361
|
|
-# #right
|
362
|
|
- if rLR > 0.080:
|
363
|
|
- followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
|
364
|
|
- cont.activate(followcam.actuators["rotright"])
|
365
|
|
- else:
|
366
|
|
- cont.deactivate(followcam.actuators["rotright"])
|
|
313
|
+ scene.active_camera = followcam
|
|
314
|
+ #################
|
|
315
|
+ camspeed1 = .04 #.015
|
|
316
|
+ camspeed2 = .1 #.055
|
|
317
|
+ camrot1 = .02 #.005
|
|
318
|
+ camrot2 = .04 #.02
|
|
319
|
+ #up
|
|
320
|
+ if lUD < -0.080:
|
|
321
|
+ followcam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
|
|
322
|
+ cont.activate(followcam.actuators["up"])
|
|
323
|
+ #print("fastup")
|
|
324
|
+ else:
|
|
325
|
+ cont.deactivate(followcam.actuators["up"])
|
|
326
|
+ # #down
|
|
327
|
+ if lUD > .080:
|
|
328
|
+ followcam.actuators["down"].dLoc = [ 0, 0, camspeed2]
|
|
329
|
+ cont.activate(followcam.actuators["down"])
|
|
330
|
+ else:
|
|
331
|
+ cont.deactivate(followcam.actuators["down"])
|
|
332
|
+ # #left
|
|
333
|
+ if lLR < -0.080:
|
|
334
|
+ followcam.actuators["left"].dLoc = [-camspeed2, 0, 0]
|
|
335
|
+ cont.activate(followcam.actuators["left"])
|
|
336
|
+ else:
|
|
337
|
+ cont.deactivate(followcam.actuators["left"])
|
|
338
|
+ # #right
|
|
339
|
+ if lLR > 0.080:
|
|
340
|
+ followcam.actuators["right"].dLoc = [camspeed2, 0, 0]
|
|
341
|
+ cont.activate(followcam.actuators["right"])
|
|
342
|
+ else:
|
|
343
|
+ cont.deactivate(followcam.actuators["right"])
|
|
344
|
+ #up
|
|
345
|
+ if rUD < -0.080:
|
|
346
|
+ followcam.actuators["rotup"].dLoc = [0, 0, camrot2]
|
|
347
|
+ cont.activate(followcam.actuators["rotup"])
|
|
348
|
+ #print("uppppppppppppppppppppppppppp")
|
|
349
|
+ else:
|
|
350
|
+ cont.deactivate(followcam.actuators["rotup"])
|
|
351
|
+ # #down
|
|
352
|
+ if rUD > .080:
|
|
353
|
+ followcam.actuators["rotdown"].dLoc = [0, 0, -camrot2]
|
|
354
|
+ cont.activate(followcam.actuators["rotdown"])
|
|
355
|
+ else:
|
|
356
|
+ cont.deactivate(followcam.actuators["rotdown"])
|
|
357
|
+ # #left
|
|
358
|
+ if rLR < -0.080:
|
|
359
|
+ followcam.actuators["rotleft"].dRot = [0, 0, camrot2]
|
|
360
|
+ cont.activate(followcam.actuators["rotleft"])
|
|
361
|
+ else:
|
|
362
|
+ cont.deactivate(followcam.actuators["rotleft"])
|
|
363
|
+ # #right
|
|
364
|
+ if rLR > 0.080:
|
|
365
|
+ followcam.actuators["rotright"].dRot = [0, 0, -camrot2]
|
|
366
|
+ cont.activate(followcam.actuators["rotright"])
|
|
367
|
+ else:
|
|
368
|
+ cont.deactivate(followcam.actuators["rotright"])
|
367
|
369
|
|
368
|
|
-#*********************************************
|
|
370
|
+ #*********************************************
|
|
371
|
+
|
|
372
|
+ if lUD > -0.080 and lUD < -0.030:
|
|
373
|
+ followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
|
|
374
|
+ cont.activate(followcam.actuators["up"])
|
|
375
|
+ #print(lUD)
|
|
376
|
+ else:
|
|
377
|
+ cont.deactivate(followcam.actuators["up"])
|
|
378
|
+ # #down
|
|
379
|
+ if lUD < .080 and lUD > .03:
|
|
380
|
+ followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
|
|
381
|
+ cont.activate(followcam.actuators["down"])
|
|
382
|
+ else:
|
|
383
|
+ cont.deactivate(followcam.actuators["down"])
|
|
384
|
+ # #left
|
|
385
|
+ if lLR > -0.080 and lLR < -0.030:
|
|
386
|
+ followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
|
|
387
|
+ cont.activate(followcam.actuators["left"])
|
|
388
|
+ else:
|
|
389
|
+ cont.deactivate(followcam.actuators["left"])
|
|
390
|
+ # #right
|
|
391
|
+ if lLR < .080 and lLR > .03:
|
|
392
|
+ followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
|
|
393
|
+ cont.activate(followcam.actuators["right"])
|
|
394
|
+ else:
|
|
395
|
+ cont.deactivate(followcam.actuators["right"])
|
|
396
|
+ #up
|
|
397
|
+ if rUD > -0.080 and rUD < -0.030:
|
|
398
|
+ followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
|
|
399
|
+ cont.activate(followcam.actuators["rotup"])
|
|
400
|
+ else:
|
|
401
|
+ cont.deactivate(followcam.actuators["rotup"])
|
|
402
|
+ # #down
|
|
403
|
+ if rUD < .080 and rUD > .03:
|
|
404
|
+ followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
|
|
405
|
+ cont.activate(followcam.actuators["rotdown"])
|
|
406
|
+ else:
|
|
407
|
+ cont.deactivate(followcam.actuators["rotdown"])
|
|
408
|
+ # #left
|
|
409
|
+ if rLR > -0.080 and rLR < -0.030:
|
|
410
|
+ followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
|
|
411
|
+ cont.activate(followcam.actuators["rotleft"])
|
|
412
|
+ else:
|
|
413
|
+ cont.deactivate(followcam.actuators["rotleft"])
|
|
414
|
+ # #right
|
|
415
|
+ if rLR < .080 and rLR > .03:
|
|
416
|
+ followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
|
|
417
|
+ cont.activate(followcam.actuators["rotright"])
|
|
418
|
+ else:
|
|
419
|
+ cont.deactivate(followcam.actuators["rotright"])
|
369
|
420
|
|
370
|
|
- if lUD > -0.080 and lUD < -0.030:
|
371
|
|
- followcam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
|
372
|
|
- cont.activate(followcam.actuators["up"])
|
373
|
|
- #print(lUD)
|
374
|
|
- else:
|
375
|
|
- cont.deactivate(followcam.actuators["up"])
|
376
|
|
-# #down
|
377
|
|
- if lUD < .080 and lUD > .03:
|
378
|
|
- followcam.actuators["down"].dLoc = [ 0, 0, camspeed1]
|
379
|
|
- cont.activate(followcam.actuators["down"])
|
380
|
|
- else:
|
381
|
|
- cont.deactivate(followcam.actuators["down"])
|
382
|
|
-# #left
|
383
|
|
- if lLR > -0.080 and lLR < -0.030:
|
384
|
|
- followcam.actuators["left"].dLoc = [-camspeed1, 0, 0]
|
385
|
|
- cont.activate(followcam.actuators["left"])
|
386
|
|
- else:
|
387
|
|
- cont.deactivate(followcam.actuators["left"])
|
388
|
|
-# #right
|
389
|
|
- if lLR < .080 and lLR > .03:
|
390
|
|
- followcam.actuators["right"].dLoc = [camspeed1, 0, 0]
|
391
|
|
- cont.activate(followcam.actuators["right"])
|
392
|
|
- else:
|
393
|
|
- cont.deactivate(followcam.actuators["right"])
|
394
|
|
- #up
|
395
|
|
- if rUD > -0.080 and rUD < -0.030:
|
396
|
|
- followcam.actuators["rotup"].dRot = [camrot1, 0, 0]
|
397
|
|
- cont.activate(followcam.actuators["rotup"])
|
398
|
|
- else:
|
399
|
|
- cont.deactivate(followcam.actuators["rotup"])
|
400
|
|
-# #down
|
401
|
|
- if rUD < .080 and rUD > .03:
|
402
|
|
- followcam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
|
403
|
|
- cont.activate(followcam.actuators["rotdown"])
|
404
|
|
- else:
|
405
|
|
- cont.deactivate(followcam.actuators["rotdown"])
|
406
|
|
-# #left
|
407
|
|
- if rLR > -0.080 and rLR < -0.030:
|
408
|
|
- followcam.actuators["rotleft"].dRot = [0, 0, camrot1]
|
409
|
|
- cont.activate(followcam.actuators["rotleft"])
|
410
|
|
- else:
|
411
|
|
- cont.deactivate(followcam.actuators["rotleft"])
|
412
|
|
-# #right
|
413
|
|
- if rLR < .080 and rLR > .03:
|
414
|
|
- followcam.actuators["rotright"].dRot = [0, 0, -camrot1]
|
415
|
|
- cont.activate(followcam.actuators["rotright"])
|
416
|
|
- else:
|
417
|
|
- cont.deactivate(followcam.actuators["rotright"])
|
418
|
|
-
|
419
|
|
- #################
|
420
|
|
-
|
421
|
|
- if own['camnum'] == 2 and own['playback']:
|
422
|
|
-
|
423
|
|
- scene.active_camera = freecam
|
424
|
|
-
|
425
|
|
- #act = freecam.actuators[
|
426
|
|
- camspeed1 = .015
|
427
|
|
- camspeed2 = .055
|
428
|
|
- camrot1 = .005
|
429
|
|
- camrot2 = .02
|
430
|
|
- #up
|
431
|
|
- if lUD < -0.080:
|
432
|
|
- freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
|
433
|
|
- cont.activate(freecam.actuators["up"])
|
434
|
|
- #print("fastup")
|
435
|
|
- else:
|
436
|
|
- cont.deactivate(freecam.actuators["up"])
|
437
|
|
-# #down
|
438
|
|
- if lUD > .080:
|
439
|
|
- freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
|
440
|
|
- cont.activate(freecam.actuators["down"])
|
441
|
|
- else:
|
442
|
|
- cont.deactivate(freecam.actuators["down"])
|
443
|
|
-# #left
|
444
|
|
- if lLR < -0.080:
|
445
|
|
- freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
|
446
|
|
- cont.activate(freecam.actuators["left"])
|
447
|
|
- else:
|
448
|
|
- cont.deactivate(freecam.actuators["left"])
|
449
|
|
-# #right
|
450
|
|
- if lLR > 0.080:
|
451
|
|
- freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
|
452
|
|
- cont.activate(freecam.actuators["right"])
|
453
|
|
- else:
|
454
|
|
- cont.deactivate(freecam.actuators["right"])
|
455
|
|
- #up
|
456
|
|
- if rUD < -0.080:
|
457
|
|
- freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
|
458
|
|
- cont.activate(freecam.actuators["rotup"])
|
459
|
|
- else:
|
460
|
|
- cont.deactivate(freecam.actuators["rotup"])
|
461
|
|
-# #down
|
462
|
|
- if rUD > .080:
|
463
|
|
- freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
|
464
|
|
- cont.activate(freecam.actuators["rotdown"])
|
465
|
|
- else:
|
466
|
|
- cont.deactivate(freecam.actuators["rotdown"])
|
467
|
|
-# #left
|
468
|
|
- if rLR < -0.080:
|
469
|
|
- freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
|
470
|
|
- cont.activate(freecam.actuators["rotleft"])
|
471
|
|
- else:
|
472
|
|
- cont.deactivate(freecam.actuators["rotleft"])
|
473
|
|
-# #right
|
474
|
|
- if rLR > 0.080:
|
475
|
|
- freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
|
476
|
|
- cont.activate(freecam.actuators["rotright"])
|
477
|
|
- else:
|
478
|
|
- cont.deactivate(freecam.actuators["rotright"])
|
479
|
|
-
|
480
|
|
-#*********************************************
|
|
421
|
+ #################
|
|
422
|
+
|
|
423
|
+ if own['camnum'] == 2 and own['playback']:
|
481
|
424
|
|
482
|
|
- if lUD > -0.080 and lUD < -0.030:
|
483
|
|
- freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
|
484
|
|
- cont.activate(freecam.actuators["up"])
|
485
|
|
- #print(lUD)
|
486
|
|
- else:
|
487
|
|
- cont.deactivate(freecam.actuators["up"])
|
488
|
|
-# #down
|
489
|
|
- if lUD < .080 and lUD > .03:
|
490
|
|
- freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
|
491
|
|
- cont.activate(freecam.actuators["down"])
|
492
|
|
- else:
|
493
|
|
- cont.deactivate(freecam.actuators["down"])
|
494
|
|
-# #left
|
495
|
|
- if lLR > -0.080 and lLR < -0.030:
|
496
|
|
- freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
|
497
|
|
- cont.activate(freecam.actuators["left"])
|
498
|
|
- else:
|
499
|
|
- cont.deactivate(freecam.actuators["left"])
|
500
|
|
-# #right
|
501
|
|
- if lLR < .080 and lLR > .03:
|
502
|
|
- freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
|
503
|
|
- cont.activate(freecam.actuators["right"])
|
504
|
|
- else:
|
505
|
|
- cont.deactivate(freecam.actuators["right"])
|
506
|
|
- #up
|
507
|
|
- if rUD > -0.080 and rUD < -0.030:
|
508
|
|
- freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
|
509
|
|
- cont.activate(freecam.actuators["rotup"])
|
510
|
|
- else:
|
511
|
|
- cont.deactivate(freecam.actuators["rotup"])
|
512
|
|
-# #down
|
513
|
|
- if rUD < .080 and rUD > .03:
|
514
|
|
- freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
|
515
|
|
- cont.activate(freecam.actuators["rotdown"])
|
516
|
|
- else:
|
517
|
|
- cont.deactivate(freecam.actuators["rotdown"])
|
518
|
|
-# #left
|
519
|
|
- if rLR > -0.080 and rLR < -0.030:
|
520
|
|
- freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
|
521
|
|
- cont.activate(freecam.actuators["rotleft"])
|
522
|
|
- else:
|
523
|
|
- cont.deactivate(freecam.actuators["rotleft"])
|
524
|
|
-# #right
|
525
|
|
- if rLR < .080 and rLR > .03:
|
526
|
|
- freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
|
527
|
|
- cont.activate(freecam.actuators["rotright"])
|
528
|
|
- else:
|
529
|
|
- cont.deactivate(freecam.actuators["rotright"])
|
530
|
|
-########################################
|
531
|
|
- if own['camnum'] == 0:
|
532
|
|
- cam = camList["Camera.003"]
|
533
|
|
- scene.active_camera = cam
|
534
|
|
- valueIndex = own['valueIndex']
|
535
|
|
- n = (valueIndex / recording_cutoff) * 1000
|
536
|
|
- n = int(round(n))
|
537
|
|
- #n = 10
|
538
|
|
- #print("n: ", n, "--", valueIndex, recording_cutoff)
|
539
|
|
- #dict = logic.globalDict #Get the global dictionary
|
540
|
|
- dict['playhead'] = n
|
541
|
|
-
|
542
|
|
- own['last_back_but'] = own['back_but']
|
543
|
|
- own['back_but'] = back_on
|
544
|
|
- own['last_a_but'] = own['a_but']
|
545
|
|
- own['a_but'] = a_on
|
546
|
|
- own['last_ltsBut'] = ltsBut
|
547
|
|
- own['last_rtsBut'] = rtsBut
|
548
|
|
- own['last_playback'] = own['playback']
|
|
425
|
+ scene.active_camera = freecam
|
|
426
|
+
|
|
427
|
+ #act = freecam.actuators[
|
|
428
|
+ camspeed1 = .015
|
|
429
|
+ camspeed2 = .055
|
|
430
|
+ camrot1 = .005
|
|
431
|
+ camrot2 = .02
|
|
432
|
+ #up
|
|
433
|
+ if lUD < -0.080:
|
|
434
|
+ freecam.actuators["up"].dLoc = [ 0, 0, -camspeed2]
|
|
435
|
+ cont.activate(freecam.actuators["up"])
|
|
436
|
+ #print("fastup")
|
|
437
|
+ else:
|
|
438
|
+ cont.deactivate(freecam.actuators["up"])
|
|
439
|
+ # #down
|
|
440
|
+ if lUD > .080:
|
|
441
|
+ freecam.actuators["down"].dLoc = [ 0, 0, camspeed2]
|
|
442
|
+ cont.activate(freecam.actuators["down"])
|
|
443
|
+ else:
|
|
444
|
+ cont.deactivate(freecam.actuators["down"])
|
|
445
|
+ # #left
|
|
446
|
+ if lLR < -0.080:
|
|
447
|
+ freecam.actuators["left"].dLoc = [-camspeed2, 0, 0]
|
|
448
|
+ cont.activate(freecam.actuators["left"])
|
|
449
|
+ else:
|
|
450
|
+ cont.deactivate(freecam.actuators["left"])
|
|
451
|
+ # #right
|
|
452
|
+ if lLR > 0.080:
|
|
453
|
+ freecam.actuators["right"].dLoc = [camspeed2, 0, 0]
|
|
454
|
+ cont.activate(freecam.actuators["right"])
|
|
455
|
+ else:
|
|
456
|
+ cont.deactivate(freecam.actuators["right"])
|
|
457
|
+ #up
|
|
458
|
+ if rUD < -0.080:
|
|
459
|
+ freecam.actuators["rotup"].dRot = [camrot2, 0, 0]
|
|
460
|
+ cont.activate(freecam.actuators["rotup"])
|
|
461
|
+ else:
|
|
462
|
+ cont.deactivate(freecam.actuators["rotup"])
|
|
463
|
+ # #down
|
|
464
|
+ if rUD > .080:
|
|
465
|
+ freecam.actuators["rotdown"].dRot = [-camrot2, 0, 0]
|
|
466
|
+ cont.activate(freecam.actuators["rotdown"])
|
|
467
|
+ else:
|
|
468
|
+ cont.deactivate(freecam.actuators["rotdown"])
|
|
469
|
+ # #left
|
|
470
|
+ if rLR < -0.080:
|
|
471
|
+ freecam.actuators["rotleft"].dRot = [0, 0, camrot2]
|
|
472
|
+ cont.activate(freecam.actuators["rotleft"])
|
|
473
|
+ else:
|
|
474
|
+ cont.deactivate(freecam.actuators["rotleft"])
|
|
475
|
+ # #right
|
|
476
|
+ if rLR > 0.080:
|
|
477
|
+ freecam.actuators["rotright"].dRot = [0, 0, -camrot2]
|
|
478
|
+ cont.activate(freecam.actuators["rotright"])
|
|
479
|
+ else:
|
|
480
|
+ cont.deactivate(freecam.actuators["rotright"])
|
|
481
|
+
|
|
482
|
+ #*********************************************
|
|
483
|
+
|
|
484
|
+ if lUD > -0.080 and lUD < -0.030:
|
|
485
|
+ freecam.actuators["up"].dLoc = [ 0, 0, -camspeed1]
|
|
486
|
+ cont.activate(freecam.actuators["up"])
|
|
487
|
+ #print(lUD)
|
|
488
|
+ else:
|
|
489
|
+ cont.deactivate(freecam.actuators["up"])
|
|
490
|
+ # #down
|
|
491
|
+ if lUD < .080 and lUD > .03:
|
|
492
|
+ freecam.actuators["down"].dLoc = [ 0, 0, camspeed1]
|
|
493
|
+ cont.activate(freecam.actuators["down"])
|
|
494
|
+ else:
|
|
495
|
+ cont.deactivate(freecam.actuators["down"])
|
|
496
|
+ # #left
|
|
497
|
+ if lLR > -0.080 and lLR < -0.030:
|
|
498
|
+ freecam.actuators["left"].dLoc = [-camspeed1, 0, 0]
|
|
499
|
+ cont.activate(freecam.actuators["left"])
|
|
500
|
+ else:
|
|
501
|
+ cont.deactivate(freecam.actuators["left"])
|
|
502
|
+ # #right
|
|
503
|
+ if lLR < .080 and lLR > .03:
|
|
504
|
+ freecam.actuators["right"].dLoc = [camspeed1, 0, 0]
|
|
505
|
+ cont.activate(freecam.actuators["right"])
|
|
506
|
+ else:
|
|
507
|
+ cont.deactivate(freecam.actuators["right"])
|
|
508
|
+ #up
|
|
509
|
+ if rUD > -0.080 and rUD < -0.030:
|
|
510
|
+ freecam.actuators["rotup"].dRot = [camrot1, 0, 0]
|
|
511
|
+ cont.activate(freecam.actuators["rotup"])
|
|
512
|
+ else:
|
|
513
|
+ cont.deactivate(freecam.actuators["rotup"])
|
|
514
|
+ # #down
|
|
515
|
+ if rUD < .080 and rUD > .03:
|
|
516
|
+ freecam.actuators["rotdown"].dRot = [-camrot1, 0, 0]
|
|
517
|
+ cont.activate(freecam.actuators["rotdown"])
|
|
518
|
+ else:
|
|
519
|
+ cont.deactivate(freecam.actuators["rotdown"])
|
|
520
|
+ # #left
|
|
521
|
+ if rLR > -0.080 and rLR < -0.030:
|
|
522
|
+ freecam.actuators["rotleft"].dRot = [0, 0, camrot1]
|
|
523
|
+ cont.activate(freecam.actuators["rotleft"])
|
|
524
|
+ else:
|
|
525
|
+ cont.deactivate(freecam.actuators["rotleft"])
|
|
526
|
+ # #right
|
|
527
|
+ if rLR < .080 and rLR > .03:
|
|
528
|
+ freecam.actuators["rotright"].dRot = [0, 0, -camrot1]
|
|
529
|
+ cont.activate(freecam.actuators["rotright"])
|
|
530
|
+ else:
|
|
531
|
+ cont.deactivate(freecam.actuators["rotright"])
|
|
532
|
+ ########################################
|
|
533
|
+ if own['camnum'] == 0:
|
|
534
|
+ cam = camList["Camera.003"]
|
|
535
|
+ scene.active_camera = cam
|
|
536
|
+ valueIndex = own['valueIndex']
|
|
537
|
+ n = (valueIndex / recording_cutoff) * 1000
|
|
538
|
+ n = int(round(n))
|
|
539
|
+ #n = 10
|
|
540
|
+ #print("n: ", n, "--", valueIndex, recording_cutoff)
|
|
541
|
+ #dict = logic.globalDict #Get the global dictionary
|
|
542
|
+ dict['playhead'] = n
|
|
543
|
+
|
|
544
|
+ own['last_back_but'] = own['back_but']
|
|
545
|
+ own['back_but'] = back_on
|
|
546
|
+ own['last_a_but'] = own['a_but']
|
|
547
|
+ own['a_but'] = a_on
|
|
548
|
+ own['last_ltsBut'] = ltsBut
|
|
549
|
+ own['last_rtsBut'] = rtsBut
|
|
550
|
+ own['last_playback'] = own['playback']
|