WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-13-2011, 04:51 AM
Zword Zword is offline
Member
 
Join Date: Jan 2011
Posts: 6
moving object forward backward

When the mouse is pointed at the object I want to move it depending on wich key i press. A normal int number works but example +=0.5 does not work.

Code:


Code:
cube = vizshape.addCube()

def moveForward():
	object = viz.pick()
	if object.valid():
		pos += 10
		object.setPosition([pos],0,0)
		print 'move backward'

vizact.onkeydown( 'w', moveForward )

def moveBackward ():
	object = viz.pick()
	if object.valid():
		pos += 10
		object.setPosition([pos],0,0)
	print 'move forward'
	
vizact.onkeydown( 's', moveBackward )
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve Object names Geoffrey Vizard 11 12-11-2009 04:26 AM
Attaching sound to a moving object GiudiceLab Vizard 6 08-21-2009 08:52 AM
moving and object by mouse but don't know how to stop the movement nlfrnassimi Vizard 8 04-26-2009 07:23 AM
Moving view with object Xliben Vizard 2 07-25-2005 05:36 PM


All times are GMT -7. The time now is 11:58 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC