Hey Dude
How add texture animation in BGE?
I want a video texture in loop in tv model in my scene. :spin:
from bge import logic, texture
def play(cont):
obj = cont.owner
# the creation of the texture must be done once: save the
# texture object in an attribute of bge.logic module makes it persistent
if not hasattr(logic, 'video'):
# put a material on the object, put the name of the material
# below. and at MA in front of the material name
matID = texture.materialID(obj, 'MAplop')
# create a dynamic texture that will replace the static texture
logic.video = texture.Texture(obj, matID)
# define a source of image for the texture, here a movie
movie = logic.expandPath('//WiegelesHeliSki_DivXPlus_19Mbps.mkv')
logic.video.source = texture.VideoFFmpeg(movie)
logic.video.source.scale = True
# quick off the movie, but it wont play in the background
logic.video.source.play()
# you need to call this function every frame to ensure update of the texture.
logic.video.refresh(True)
and here is a .blend
video_to_texture.blend (510 KB)
video not included, put a video in the same directory as the .blend and change the name in the script
Cool
And for keep loop infinity?
Thank, the example will suit me, too.
Here is the source i used:
https://docs.blender.org/api/blender_python_api_2_66_4/bge.texture.html
repeat = -1
Info menu >> Engine box >> Blender Game
3D View menu >> Viewport Shading Box >> Textured
Mario Mirror Adventure