WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-06-2007, 09:44 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Question Object animation using a picture?

I need to animate a picture such that it moves forward a bit and backward a bit. Kind of like a moving room. I'm having trouble; here's what I've got:

import viz

tex1 = viz.add('picture.jpg')
quad = viz.add(viz.TEXQUAD)
quad.translate(0,1,12)
quad.scale(12.8, 10.24)
quad.texture(tex1)

moveForward = vizact.move(0,0,2,5)
moveBackward = vizact.move(0,0,-2,5)
#tex1.add(moveForward)
#tex1.add(moveBackward)
MovingRoom = vizact.sequence(moveForward,moveBackward,4)


def onkeydown(key):
if key == ' ':
tex1.add(MovingRoom)

viz.callback(viz.KEYDOWN_EVENT,onkeydown)

But when I run the script I get this error message:
Traceback (most recent call last):
File "Moving Room 3.py", line 25, in onkeydown
tex1.add(MovingRoom)
AttributeError: VizTexture instance has no attribute 'add'

Which, I guess, makes sense to me. But I wondering if there is a way around this. Like, how can I make it such that the picture moves forward X distance for Y duration and then backward X distance for Y duration...etc (i.e. put that in a loop/timer). Namely, I'd like the picture to keep moving forward and backward the entire time the script is running.

Thanks for the help.
Reply With Quote
 

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


All times are GMT -7. The time now is 08:40 AM.


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