WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-17-2009, 03:17 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you want to move your object with the mouse along just the x-axis you could either translate mouse movement into object movement with something like this
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)

ball = viz.add('ball.wrl')

def mymouse(e):
    #Move the object based on the mouse position
    ball.setPosition((e.x-0.5)*6,2,8)

viz.callback(viz.MOUSE_MOVE_EVENT, mymouse)
or you could move the object with the mouse buttons
Code:
#Disable mouse navigation
viz.mouse(viz.OFF)

ball = viz.add('ball.wrl', pos = [0,2,8])

#use buttons to control ball
vizact.whilemousedown(viz.MOUSEBUTTON_LEFT, ball.translate,vizact.elapsed(-1),0,0,viz.REL_PARENT)
vizact.whilemousedown(viz.MOUSEBUTTON_RIGHT, ball.translate,vizact.elapsed(1),0,0,viz.REL_PARENT)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Sharing Files on SourceForge farshizzo Vizard 1 09-03-2012 11:18 AM
Need help with a project mberkes Vizard 14 05-27-2009 11:54 AM
Project .avi or .mpeg file pattie Vizard 2 02-06-2007 08:09 AM


All times are GMT -7. The time now is 03:59 AM.


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