Introduction and Beginner Guide to Vizard VR Development Platform
This article introduces Vizard, a C/C++‑based virtual‑reality development platform with Python support, and provides step‑by‑step code examples for loading avatars, creating random pigeon walks, implementing character dialogue, handling movement and mouse input, and showcasing typical VR scene effects.
Vizard is a virtual‑reality development platform that has been evolving for ten years; it is built on C/C++ and uses a high‑performance graphics engine powered by recent OpenGL extensions. When Python is used for development, Vizard automatically compiles the script into a bytecode abstraction layer (LAXMI) that runs on the rendering core.
Vizard Beginner Guide
1. Load avatars, objects and background
avatar = viz.addAvatar('xxx.cfg', pos=(0,0,0), euler=(0,0,0))
viz.add('xxx.osgb', pos=(0,0,0), euler=(0,0,0))
viz.addChild('xxx.obj', pos=(-4,0,7.5))2. Pigeon random walk
pigeon = viz.addAvatar('pigeon.cfg', pos=(2,0,5))
random_walk = vizact.walkTo(pos=[vizact.randfloat(1.5,2.5),0,vizact.randfloat(4.5,5.5)])
random_animation = vizact.method.state(vizact.choice([1,3], vizact.RANDOM))
random_wait = vizact.waittime(vizact.randfloat(2.0,8.0))
pigeon_idle = vizact.sequence(random_walk, random_animation, random_wait, viz.FOREVER)
pigeon.runAction(pigeon_idle)3. Character talk actions
def PersonTalk():
female = viz.addAvatar('vcc_female.cfg', pos=(1,0,8), euler=(-90,0,0))
male = viz.addAvatar('vcc_male2.cfg', pos=(0,0,8), euler=(90,0,0))
female.state(14)
male.state(4)4. Character movement
def roleMove():
m1 = viz.Matrix.euler(0,0,0)
dm = viz.getFrameElapsed() * speed
temp = avatar.getEuler()[0] * math.pi/180
if viz.key.isDown('w'):
m1.preTrans([dm*math.sin(temp),0,dm*math.cos(temp)])
avatar.state(2)
elif viz.key.isDown('s'):
m1.preTrans([-dm*math.sin(temp),0,-dm*math.cos(temp)])
avatar.state(2)
elif viz.key.isDown('a'):
m1.preTrans([-dm*0.3*math.cos(temp),0,dm*0.3*math.sin(temp)])
avatar.state(12)
elif viz.key.isDown('d'):
m1.preTrans([dm*0.3*math.cos(temp),0,-dm*0.3*math.sin(temp)])
avatar.state(13)
else:
avatar.state(1)
avatar.setPosition(m1.getPosition(), viz.REL_PARENT)5. Capture mouse movement
def onMouseMove(e):
global mp_x, mp_y
mp_x = e.dx
mp_y = e.dy
viz.callback(viz.MOUSE_MOVE_EVENT, onMouseMove)Effects implemented with Vizard
Clock displaying the current system time.
Two animated talking characters.
Third‑person roaming with animation.
Various 3D objects and backgrounds such as a pigeon roaming freely, a vase, sky and grassland scenes.
Python Programming Learning Circle
A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.