#1
|
|||
|
|||
Problem with object position
Hi everyone,
I'm pretty new to vizard so I'm hoping this will be an easy problem to solve! My code generates the classroom floor found in the demo and when you push the wsda keys it moves you 4 spaces for 5 seconds. I also have a red shape. The problem is the shape moves with the screen position and I want it to remain fixed! I know that it does this because of this line of code: panel.addAction(forward) #panel is the floor Does any one know how to solve this problem? Any comments or tips would be very appreciated! My code: """ This script will demonstrate how to manually animate an object using timers. """ import viz import vizact import math viz.setMultiSample(4) viz.fov(60) viz.go() import vizinfo vizinfo.InfoPanel() #Add a ground plane panel=viz.addChild('ground.osgb') panel.setPosition([0.5,-1,1]) viz.clearcolor(viz.SLATE) #add shape h=viz.addChild('tut_hedra.wrl') #Place the model in front of the viewer h.setPosition([0,0,13], viz.ABS_GLOBAL) h.setScale([1,1,1]) h.color( viz.RED ) h.transform = None #hit h and it toggles it away vizact.onkeydown('h', h.visible, viz.TOGGLE) def AnimateView(pos): action = vizact.move(pos,5) forward=vizact.sequence(action) panel.addAction(forward) viz.MainView.runAction(action) #Setup keyboard events #move Left vizact.onkeydown('d',AnimateView,(-4,0,0)) #move Right vizact.onkeydown('a',AnimateView,(4,0,0)) #move Forwards vizact.onkeydown('w',AnimateView,(0,0,-4)) #move Backwards vizact.onkeydown('s',AnimateView,(0,0,4)) #STOP vizact.onkeydown(' ',AnimateView,(0,0,0)) |
Tags |
mainview, movement, newb |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to get real time position of a object which is connected to a haptic device | Melody | Vizard | 4 | 09-15-2014 02:35 PM |
Create object with position relative to user head, but cannot be obstructed by others | Notch | Vizard | 2 | 03-03-2014 07:16 AM |
Object + InteriaCube + Viewport problem | Gekitatsu | Vizard | 1 | 02-22-2012 10:55 AM |
Can you link the position of a tracker to the orientation of an object? | michaelrepucci | Vizard | 1 | 09-19-2008 10:23 AM |
picking problem... | k_iwan | Vizard | 2 | 07-27-2007 07:57 PM |