Hi guys, I’m building an interactive storytelling kiosk and I was wondering if anyone can give me a little help…
this is the setup:
and each sensor (represented by hand figures, they go on the top of the kiosk) will trigger different stories…that can be played at once since the videos don’t overlap…I’ve been trying something like this:
from panda3d.core import *
# Tell Panda3D to use OpenAL, not FMOD
loadPrcFileData("", "textures-power-2 none")
loadPrcFileData("", "audio-library-name p3openal_audio")
from direct.showbase.DirectObject import DirectObject
from direct.gui.OnscreenText import OnscreenText
import direct.directbase.DirectStart
# The name of the media file.
MEDIAFILE1="opacity_01.mov"
MEDIAFILE2="alpha.mov"
MEDIAFILE3="opacity_02.mov"
# Function to put instructions on the screen.
def addInstructions(pos, msg):
return OnscreenText(text=msg, style=1, fg=(0,0,0,1), mayChange=1,
pos=(-1.3, pos), align=TextNode.ALeft, scale = .05, shadow=(1,1,1,1), shadowOffset=(0.1,0.1))
# Function to put title on the screen.
def addTitle(text):
return OnscreenText(text=text, style=1, fg=(0,0,0,1),
pos=(1.3,-0.95), align=TextNode.ARight, scale = .07, shadow=(1,1,1,1), shadowOffset=(0.05,0.05))
class World(DirectObject):
def __init__(self):
self.enterVideo1()
self.enterVideo2()
self.enterVideo3()
self.inst1 = addInstructions(0.95,"")
base.setBackgroundColor(1,1,1,1)
self.accept('p', self.playpause)
self.accept('P', self.playpause)
def enterVideo1(self):
self.tex = MovieTexture("1")
assert self.tex.read(MEDIAFILE1), "Failed to load video!"
# Set up a fullscreen card to set the video texture on.
cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(self.tex)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTransparency(TransparencyAttrib.MAlpha)
card.setScale(card, 0.8)
card.setTexture(self.tex)
card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())
self.sound=loader.loadSfx('tree.wav')
# Synchronize the video to the sound.
self.tex.synchronizeTo(self.sound)
def enterVideoAlpha(self):
self.tex = MovieTexture("2")
assert self.tex.read(MEDIAFILE2), "Failed to load video!"
# Set up a fullscreen card to set the video texture on.
cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(self.tex)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTransparency(TransparencyAttrib.MAlpha)
card.setScale(card, 0.8)
card.setTexture(self.tex)
card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())
def enterVideo3(self):
self.tex = MovieTexture("3")
assert self.tex.read(MEDIAFILE3), "Failed to load video!"
# Set up a fullscreen card to set the video texture on.
cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(self.tex)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTransparency(TransparencyAttrib.MAlpha)
card.setScale(card, 0.8)
card.setTexture(self.tex)
card.setTexScale(TextureStage.getDefault(), self.tex.getTexScale())
def stopsound(self):
self.sound.stop()
self.sound.setPlayRate(1.0)
def fastforward(self):
print self.sound.status()
if (self.sound.status() == AudioSound.PLAYING):
t = self.sound.getTime()
self.sound.stop()
if (self.sound.getPlayRate() == 1.0):
self.sound.setPlayRate(0.5)
else:
self.sound.setPlayRate(1.0)
self.sound.setTime(t)
self.sound.play()
def playpause(self):
if (self.sound.status() == AudioSound.PLAYING):
t = self.sound.getTime()
self.sound.stop()
self.sound.setTime(t)
else:
self.sound.play()
w = World()
run()
As is, it plays one video, and black as alpha…should play 2 videos simultanesouly though…
Thank you for any help you can give me!!
Videos are here if needed!
jupiter.esec.pt/~apgomes/madeira/joo.rar