#1
|
|||
|
|||
manipulating viewpoint
Hi,
I wish to create a simulation of tank movement. as it move forward, the turret will be able to turn right and left when the correspondent key is being pressed. But how do I make the turret to slowly return back to body_ori (facing in front back again) when I release the key? what I have here in the code, makes the turret to reappear to original position in a flash. also, why my turret does not turn smoothly like in TIME_EVENT? Is it normal in KEYDOWN_EVENT and KEYUP_EVENT? Code:
def onkeydown(key): if key == viz.KEY_RIGHT: view.rotate(0,1,0,turn_speed*viz.elapsed(),viz.BODY_ORI,viz.REL_PARENT) elif key == viz.KEY_LEFT: view.rotate(0,1,0,-turn_speed*viz.elapsed(),viz.BODY_ORI,viz.REL_PARENT) viz.callback(viz.KEYDOWN_EVENT,onkeydown) def onKeyUp(key): if key == viz.KEY_RIGHT: view.reset(viz.HEAD_ORI | viz.BODY_ORI) elif key == viz.KEY_LEFT: view.reset(viz.HEAD_ORI | viz.BODY_ORI) viz.callback(viz.KEYUP_EVENT,onKeyUp) |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to track the actual viewpoint | Jerry | Vizard | 3 | 05-25-2016 09:44 AM |
Draw Vector in viewpoint lookat direction | Chrissy2009 | Vizard | 2 | 05-30-2009 12:50 AM |
Avatar w/ hat cannot look at viewpoint | TrashcanPatrol | Vizard | 5 | 08-19-2008 08:26 AM |
3d viewpoint movement | spacefarer | Vizard | 9 | 07-25-2006 03:37 PM |
VRML Viewpoint error | bstankie | Vizard | 1 | 03-11-2003 02:10 PM |