WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Adding objects (https://forum.worldviz.com/showthread.php?t=5104)

bobbin_93 07-16-2014 03:32 AM

Adding objects
 
Hi,

I'm trying to learn how to use Vizard to design a programme for an experiment I'm carrying out.

I've got some images which I would like to add to Vizard as objects. These images are currently in Jpeg format. Does anyone know how to add these into my script?

Once they are in the script I'm also hoping to have them 'flying' at random tangents across the display screen. Is there any code that will automatically create these random tangents?

Thanks.

Jeff 07-16-2014 05:15 PM

You can apply the texture to a quad or other object:

http://docs.worldviz.com/vizard/#App...ure_basics.htm

The vizact library includes a number of actions (e.g. vizact.move, vizact.moveTo) that animate objects:

Code:

'''
Press the spacebar to move the quad to a random position on X axis
'''

import viz
import vizact
import vizinfo

viz.go()

vizinfo.InfoPanel()

viz.clearcolor(viz.SLATE)

quad = viz.addTexQuad(pos=[0,2,10])
texture = viz.addTexture('ball.jpg')
quad.texture(texture)

def moveQuad():
        randomNumber = vizact.randint(-5,5)
        move = vizact.moveTo([randomNumber,2,10],speed=1)
        quad.runAction(move)
       
vizact.onkeydown(' ',moveQuad)



All times are GMT -7. The time now is 12:25 AM.

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