我们正在使用Vizard编程软件 它使用Python,但我们很新,我们得到这个错误:
Indentation Error: unindent does not match any outer indentation level
在标记的行中。知道为什么吗?
import viz
import math
import viztask
count = 0
boolTime = False
viz.setMultiSample(4)
viz.fov(20)
viz.go()
viz.phys.enable()
viz.phys.setGravity( [0, 0, 0] )
viz.window.setFullscreen()
viz.setOption('viz.model.apply_collada_scale',1)
ball = viz.add('ball.dae')
ball.setPosition([-0.1,1.5,4])
#ball.setScale([0.75,0.75,0.75])
ball.collideSphere()
viz.setOption('viz.model.apply_collada_scale',1)
path = viz.addChild('path.dae')
path.setPosition([-1,1.0,4])
path.collideMesh()
#collision
path.enable(viz.COLLIDE_NOTIFY)
def onCollide(e):
global count
count = count+1
print(count)
viz.callback( viz.COLLIDE_BEGIN_EVENT, onCollide )
#mouse
viz.mouse.setOverride(viz.ON)
link = None
def grabBall():
global link
link = viz.grab( viz.Mouse, ball )
boolTime = True # ERROR HERE
def releaseBall():
global link
link.remove()
link = None
def TestReactionTime():
while boolTime:
#Wait for next frame to be drawn to screen
d = yield viztask.waitDraw()
#Save display time
displayTime = d.time
#Wait for keyboard reaction
d = yield viztask.waitMouseUp(viz.MOUSEBUTTON_LEFT)
#Calculate reaction time
reactionTime = d.time - displayTime
print(reactionTime)
vizact.onmousedown(viz.MOUSEBUTTON_LEFT, TestReactionTime)
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,grabBall)
vizact.onmouseup(viz.MOUSEBUTTON_LEFT,releaseBall)
答案 0 :(得分:1)
问题是我有标签而不是4个空格。
谢谢!