Eigene Videos abspielen in UPBGE / Zuschauerfrage



Script:

######################################################
#
# Movie.py Blender 2.6
#
# Tutorial for using Video.py can be found at
#
# www.tutorialsforblender3d.com
#
# Released under the Creative Commons Attribution 3.0 Unported License.
#
# If you use this code, please include this information header.
#
######################################################

#import bge
import bge

# get the current controller
controller = bge.logic.getCurrentController()

# get object script is attached to
obj = controller.owner

# check to see variable Video has been created
if « Video » in obj:

# get video
video = obj[« Video »]

# update the video
video.refresh(True)

# if variable Video hasn’t been created
else:

# get current scene
scene = bge.logic.getCurrentScene()

# get matID for the movie screen
matID = bge.texture.materialID(obj, « MA » + obj[‘material’])
print(matID)
# get the texture
video = bge.texture.Texture(obj, matID)

# get the name of the movie
movieName = obj[‘movie’]

# get movie path
movie = bge.logic.expandPath(‘//’ + movieName)

# get movie
video.source = bge.texture.VideoFFmpeg(movie)

# set scaling
video.source.scale = True # save mirror as an object variable
obj[« Video »] = video

# check for optional loop property
if « loop » in obj: # loop it forever
if obj[‘loop’] == True:
video.source.repeat = -1 # no looping
else:
video.source.repeat = 0

# start the video
video.source.play()

#LE

Source

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0