-2

我们正在使用 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)
4

1 回答 1

1

问题是我有制表符而不是 4 个空格。

谢谢!

于 2014-09-29T09:11:52.510 回答