WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-11-2009, 06:24 PM
nlfrnassimi nlfrnassimi is offline
Member
 
Join Date: Feb 2009
Posts: 37
I have solved the problem of assigning value to translate, the only problem left is that the right ball jumps when I try to move it but the other 2 works perfect.

import viz

viz.go()

ground = viz.add('tut_ground.wrl')
viz.clearcolor(0.5,0.5,1)
ground.disable(viz.PICKING)

soccerball1 = viz.add('soccerball.ive')
soccerball2 = viz.add('soccerball.ive')
soccerball3 = viz.add('soccerball.ive')

soccerball1.translate(-1,1.5,3)
soccerball2.translate(0,1.5,3)
soccerball3.translate(1,1.5,3)


def mouseclick(button):
global ball
if button == viz.MOUSEBUTTON_LEFT:
pickObj = viz.pick()
if pickObj.valid():
ball = pickObj



def myTranslate(key):
global ball
if not ball:
return
else:
if key == viz.KEY_UP:
ball.translate(0,0.01,0,ball)
elif key == viz.KEY_DOWN:
ball.translate(0,-0.01,0,ball)
elif key == viz.KEY_RIGHT:
ball.translate(0.01,0,0,ball)
elif key == viz.KEY_LEFT:
ball.translate(-0.01,0,0,ball)

vizact.whilekeydown(viz.KEY_UP,myTranslate,viz.KEY _UP)
vizact.whilekeydown(viz.KEY_DOWN,myTranslate, viz.KEY_DOWN)
vizact.whilekeydown(viz.KEY_RIGHT,myTranslate, viz.KEY_RIGHT)
vizact.whilekeydown(viz.KEY_LEFT,myTranslate, viz.KEY_LEFT)


viz.callback(viz.MOUSEDOWN_EVENT,mouseclick)


viz.mouse(viz.OFF)
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
Stop for... loop Johannes Vizard 20 04-01-2014 01:53 AM
How to stop vizact.move Jerry Vizard 3 06-04-2009 04:25 PM
delays with <avatar>.act and speech vsully Vizard 15 08-23-2007 04:24 PM
When a video stop ? djdesmangles Vizard 2 01-11-2007 04:15 PM
download problems & avatar action vgracie Vizard 1 09-14-2006 11:29 AM


All times are GMT -7. The time now is 10:52 PM.


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