0
這是我的小Python程序使用Vpython 我想旋轉一個框。 我想使用框軸而不是場景中的一個。 因此,例如,如果它的旋轉到右側,然後我想要「鼻子」下來,我想在盒子的視圖中做到這一點... 想象我是一架飛機;) 順便說一句:我是蟒蛇3[Python] obj.rotate對特定對象
from visual import *
a=box(size=(5,1,3),axis=(1,0,0))
def tasten():
"Looooopings "
if scene.kb.keys: #action on keyboard?
druck=scene.kb.getkey() #save to cache
if druck=='left':
a.rotate(angle=-1/100, axis=(1,0,0)) #links drehen
if druck=='right':
a.rotate(angle=1/100, axis=(1,0,0)) #rechts drehen
if druck=='up':
a.rotate(angle=-1,axis=(0,0,1)) #nose down
while True:
tasten()
您需要跟蹤對象的方向 - 它是「指向」哪個方向 - 並將其用作旋轉軸。 – martineau